With Oracle Java Cloud available for ADF PS5 deployments, I decided to deploy all my future ADF sample apps from the blog in Oracle Cloud, source code will be provided as well as it was up till now. ADF sample applications live will help to explain and present ADF functionality even better, blog readers will be able to test described functionality straight away and provide feedback without downloading and running on their machines. Currently I'm running trial instance of Oracle Cloud for database and Java, but in future I plan to purchase permanent account - let's see how it will go.
Read more about Oracle Database Cloud and Oracle Java Cloud from official documentation. Oracle Cloud right now supports ADF PS5 with certain limitations, please check documentation - however most of the sample apps will run without issues.
I have deployed in Oracle Java Cloud and tested one of the sample apps from my blog post - Tree Table Component in Oracle ADF. This app renders hierarchical data in different levels of the tree, Master-Detail relationship between two tree tables is implemented as well. Original sample app is deployed with minimal changes described below (datasource name and login config are optimized for Oracle Java Cloud). Here you can download source code for ADF app deployed in Oracle Java Cloud - TreeComponents_cloud.zip.
This app is deployed for public access, you can open it by clicking here - Tree Components in the Cloud. Sample app will be loaded and you should see two tree tables rendered with hierarchical data from sample HR schema (see URL pointing to Oracle Java Cloud instance):
We can use Oracle Cloud Service Control for Java to see a list of deployed apps - TreeComponentsApp is one of them. You can find here JNDI Location for Data Source, we will use it in Application Module - database. ADF Application Module will be using it to retrieve data from database Oracle Cloud:
We can review ADF performance for deployed apps - AM and ADF Task Flow usage:
You can deploy ADF app directly using Oracle Cloud Service Control for Java, but same is possible from integrated JDeveloper 11g PS5 environment. You should download latest JDeveloper 11.1.1.6.0 optimized for Oracle Cloud. Apparently Oracle released two JDeveloper versions under the same release number 11.1.1.6.0, Oracle Cloud release was made public around October. So, if you have old 11.1.1.6.0 - remove it and download new one. You should see OCLOUD name in JDeveloper 11.1.1.6.0 build:
I will describe now, what changes I have made to original ADF sample app in order to be able to deploy it and run in the cloud. Firstly you should change JDBC Data Source name for AM configuration, it must be set to database JNDI name, same as it is defined for us in Oracle Cloud Java. This allows to fetch data from Oracle Cloud for database:
Next Application Server connection pointing to Oracle Cloud Java instance must be defined in JDeveloper. Choose connection type - Oracle Cloud:
Provide connection details as per Oracle Cloud documentation and you are almost done.
Almost - because there is just one additional config - ADF application login method handling. By default ADF app is protected by Oracle Cloud security, but I want to make my ADF sample apps public and accessible to everyone. For this reason, I need to include empty login configuration into web.xml - the rest will be handled by Oracle Cloud and ADF app will be public accessible:
This config was suggested by Oracle Cloud automatically, when I was trying to deploy sample app. Deployer creates optimization suggestions and lists them in the deployment log accessible from JDeveloper:
Thats all about ADF deployment to the cloud - very straightforward. Now few words about database schema in the cloud. As usual - I'm using sample HR schema for my sample ADF apps. You can access Oracle Cloud database instance directly from JDeveloper, read this white paper - Data Movement and the Oracle Database Cloud Service. Data can be imported and exported from JDeveloper. However, there is another quick way to populate Oracle Database Cloud - using SQL scripts. Open Oracle Database Cloud instance and go to SQL Scripts section:
I was using HR schema SQL scripts and generated all required tables and populated data:
HR schema data is in the cloud and ready to be accessed from ADF app deployed in Oracle Java Cloud:
I was testing ADF passivation/activation to see if PS_TXN table is automatically created in Oracle Database Cloud. Yes, table was created automatically - perfect:
Read more about Oracle Database Cloud and Oracle Java Cloud from official documentation. Oracle Cloud right now supports ADF PS5 with certain limitations, please check documentation - however most of the sample apps will run without issues.
I have deployed in Oracle Java Cloud and tested one of the sample apps from my blog post - Tree Table Component in Oracle ADF. This app renders hierarchical data in different levels of the tree, Master-Detail relationship between two tree tables is implemented as well. Original sample app is deployed with minimal changes described below (datasource name and login config are optimized for Oracle Java Cloud). Here you can download source code for ADF app deployed in Oracle Java Cloud - TreeComponents_cloud.zip.
This app is deployed for public access, you can open it by clicking here - Tree Components in the Cloud. Sample app will be loaded and you should see two tree tables rendered with hierarchical data from sample HR schema (see URL pointing to Oracle Java Cloud instance):
We can use Oracle Cloud Service Control for Java to see a list of deployed apps - TreeComponentsApp is one of them. You can find here JNDI Location for Data Source, we will use it in Application Module - database. ADF Application Module will be using it to retrieve data from database Oracle Cloud:
We can review ADF performance for deployed apps - AM and ADF Task Flow usage:
You can deploy ADF app directly using Oracle Cloud Service Control for Java, but same is possible from integrated JDeveloper 11g PS5 environment. You should download latest JDeveloper 11.1.1.6.0 optimized for Oracle Cloud. Apparently Oracle released two JDeveloper versions under the same release number 11.1.1.6.0, Oracle Cloud release was made public around October. So, if you have old 11.1.1.6.0 - remove it and download new one. You should see OCLOUD name in JDeveloper 11.1.1.6.0 build:
I will describe now, what changes I have made to original ADF sample app in order to be able to deploy it and run in the cloud. Firstly you should change JDBC Data Source name for AM configuration, it must be set to database JNDI name, same as it is defined for us in Oracle Cloud Java. This allows to fetch data from Oracle Cloud for database:
Next Application Server connection pointing to Oracle Cloud Java instance must be defined in JDeveloper. Choose connection type - Oracle Cloud:
Provide connection details as per Oracle Cloud documentation and you are almost done.
Almost - because there is just one additional config - ADF application login method handling. By default ADF app is protected by Oracle Cloud security, but I want to make my ADF sample apps public and accessible to everyone. For this reason, I need to include empty login configuration into web.xml - the rest will be handled by Oracle Cloud and ADF app will be public accessible:
This config was suggested by Oracle Cloud automatically, when I was trying to deploy sample app. Deployer creates optimization suggestions and lists them in the deployment log accessible from JDeveloper:
Thats all about ADF deployment to the cloud - very straightforward. Now few words about database schema in the cloud. As usual - I'm using sample HR schema for my sample ADF apps. You can access Oracle Cloud database instance directly from JDeveloper, read this white paper - Data Movement and the Oracle Database Cloud Service. Data can be imported and exported from JDeveloper. However, there is another quick way to populate Oracle Database Cloud - using SQL scripts. Open Oracle Database Cloud instance and go to SQL Scripts section:
I was using HR schema SQL scripts and generated all required tables and populated data:
HR schema data is in the cloud and ready to be accessed from ADF app deployed in Oracle Java Cloud:
I was testing ADF passivation/activation to see if PS_TXN table is automatically created in Oracle Database Cloud. Yes, table was created automatically - perfect:
12 comments:
Andrejus,
Fantastic post - thanks! However, I'm wondering if there's something specific you had to do to your Cloud account to enable public access of the application. I've deployed your application to my cloud account, but attempting to access it just results in a 403. You can see for yourself:
https://java-trialac2c.java.us1.oraclecloudapps.com/tree/
Any thoughts?
Thanks,
Brian
This is because your URL is incomplete, you should add faces/main
Complete URL for your deployment: https://java-trialac2c.java.us1.oraclecloudapps.com/tree/faces/main
I see that tables are missing, you need to import HR schema to database cloud.
Regards,
Andrejus
Yes, importing the HR tables was my next adventure. I'm curious what approach you took to do this. Did you run the scripts, use SQL Developer, JPA, ...?
Thanks,
Brian
Hi,
I just run the scripts in Oracle DB cloud web console, simple and it works fast :)
Andrejus
Well, the hr_main.sql contains 5 prompts(password for HR, tablespace for HR, temporary tablespace for HR, password for SYS, and log path), which I don't believe SQL Workshop can handle. I can hard code the values, but I'm not even sure what they should be. For example, password for SYS? Did you run the scripts individually?
Thanks,
Brian
Yes, you can run them one by one. No need to run main script.
Andrejus
OK, so my confusion was with the fact that I only have a single schema to work with in my cloud account. I didn't create the HR schema, rather I added the HR tables to the schema provided for me by running: hr_cre, hr_popul, hr_idx, hr_code, hr_comnt. Thanks!
/Brian
Hi Andrejus, thank you very much for the wonderful post,
I am facing issue while creating connection to Cloud server using Jdev IDE
Below the is the failure message
Testing Cloud-Admin ... failed.
listApplications failed.
Check username, password, domain, instance.
Check cloud sdk location & version: Tools->Preferences->Oracle Cloud
0 of 1 tests successful.
I am passing the proper credentials but still could not able to connect .
Please suggest me on this.
Thanks
Kotresh
Iam also facing the same issIm using jdev 11.1.1.7.0 ue. FYI every step is there but at the end it is saying that error as:
Check username, password, domain, instance.
Check cloud sdk location & version: Tools->Preferences->Oracle Cloud
Anyone cracked it ?
Praveen, only JDev 11.1.1.6 supports the Oracle Cloud. You can get it from the Oracle Cloud Downloads page:
http://www.oracle.com/technetwork/topics/cloud/downloads/index.html
Regards,
Brian
There was new JDEV release for Oracle Cloud recently (11.1.1.7.1) - http://www.oracle.com/technetwork/developer-tools/jdev/downloads/jdeveloer111171-2183166.html
Regards,
Andrejus
Hi Andrejus,
Everytime we deploy the application on cloud, we need to change JNDI in AM, generate ear file...and then change the AM back to original settings, so that we can continue with the local development. Is there any way where during deploment creation the JNDI name can be dynamically picked up?
Problem results in changing JnDI name everytime we change from DeV to UAT to Production environment deployment
Thanks,
Hrishi
Post a Comment