Sunday, December 2, 2012

Deploying ADF Applications into the Oracle Cloud using JDeveloper


In this post I am going to show how to deploy Oracle ADF Applications into the Oracle Cloud using JDeveloper.

Prerequisites / Environment
You should have the following at your hands.
  • JDeveloper (JDEVADF_11.1.1.6.0CLOUD_GENERIC_121118.1600.6229)
  • Oracle Cloud Java Service (which includes the database cloud service as well)
  • Oracle Database (HR Schema)
  • Having deployed the DB Objects and Data (HR.EMPLOYEES and HR.DEPARTMENTS) as described in the previous post
Note: In its current stage Oracle Java Cloud Service runs WebLogic Server 10.3.6 with the appropriate Runtime ADF 11.1.1.6. Deployment of ADF 11gR2 Applications is currently not supported. Beside this limitation some ADF Features are not supported on the Oracle Cloud. According to the Oracle Cloud Documentation it is not supported to use the following ADF features
  • ADF Desktop Integration
  • ADF mBean
  • ADF MDS (Seeded customizations or cross-session personalization)
  • ADF Mobile
  • ADF Active Data Services (=> No real-time ADF Web Apps in Oracles Cloud)
  • ADF Business Components services interfaces (web services) or events
  • ADF Data Controls for BI, Essbase, BAM, and JMX
Further there are some restrictions which are good to know I think
  • No Java Mail API   (=>Sending Mails is prohibited)
  • No File system access by deployed applications (=>Writing files is prohibited)
  • No Direct use of Oracle JDBC Driver APIs
  • No Java Message Service (JMS)
  • Max Size for deployment archive 95MB

I wonder what 'ADF Mobile' in that context actually means. Mobile Browser Apps? Or the restriction that ADF Mobile Client apps cannot make use of ADF BC SDOs? Maybe someone from Oracle could comment. That would be great. Thx!

Setup ADF Application
OK, let's do the actual work. In order to have shown the whole deployment procedure (database objects and ADF Application) we are going to create a basic ADF Application that is running against a non-cloud, on-premise database first using the well known DB schema HR  - involving table EMPLOYEES and DEPARTMENTS. Remember that these table structure + data has been deployed to the Oracle Cloud Database before.

I have created Business Components for the desired tables and build a simple master-detail Page for Departments and Employees. To verify the app is functioning as expected run in on the integrated WebLogic Server prior to deploying to the Cloud:

Looks good so far.

Prepare ADF Application for Cloud Deployment
Since we want to make the ADF Application connect to the Oracle Cloud Database Service we need to make sure the applications does the right DataSource Lookup. Therefore we need the right JNDI-Name which is pretty easy to find out. 

and take a look at the associated DataSource with your Java Cloud Service.

Now the remaining task is straight forward (at least for everyone who has configured ADF Applications in the past). Open the Application Module and adjust the default configuration accordingly. That means Connection Type = JDBC DataSource with the given name database.


Note: If you want to a single configuration for on-premise and cloud just make sure to create a datasource bound to JNDI Name 'database' in your integrated WebLogic Server.

Make the ADF Application publicly accessible
By default all ADF Application deployed to Oracle Cloud will be automatically secured! When users access the application they will be redirected to authenticate against the associated identity domain. The login screen will look like that

Since I want to make the ADF Application for everyone outside the identity domain accessible there is one simple configuration change in the web.xml descriptor needed.

Just add <login-config/> at the appropriate place and the app will be public.
That's easy. The application is now ready for the Cloud Deployment.

Deploy ADF Application to Oracle Cloud
Goto 'Application > Deploy > 'deployment profile name'
[Deployment Wizard opens]

Select: Deploy to Application Server
Click: Next

Enter Connection Name: <some_conn_name>
Select Connection Type: Oracle Cloud
Click: Next

Enter Username: <Your Cloud Identity user name>
Enter Password: <Your password>


Select Data Center: <Data Center>
Enter Identity Domain: <Your identity domain name>
Service Name: <Your service name, by default it is java>
Click: Next

Test the cloud java connection
Click Next,

The ADF Deployment to the Cloud starts. Follow the processing in the Log window.
After less than 2 Minutes the ADF Application is available in the cloud. 
(If it is not available chances are high my trial oracle cloud account is expired ;) )

Some words on redeployment: On redeployment from the JDeveloper IDE the previously deployed app version is undeployed first. The the new app version is deployed as expected.

Summary 
  • Deploy DB Objects if needed to Oracle Cloud Database
  • Configure Application Module to use Connection Type JDBC DataSource, Name: database
  • Add <login-config /> to your web.xml to make the ADF Application public if needed
  • Setup up Oracle Cloud Application Server Connection
  • Deploy ADF Application via Cloud Server Connection
Conclusion
Everything worked as designed so far. No failure / exceptions occurred to me. Thanks Oracle! Great Work!

Related Posts / Documentation




3 comments:

  1. Really good piece of knowledge, I had come back to understand regarding your website from my friend Sumit, Hyderabad And it is very useful for who is looking for ORACLE ADF.

    ReplyDelete
  2. Hi , Thank you very much for the post,
    while creating connection to the application server i am facing an issue, the details are shown below
    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.

    but i am pretty sure that i am entering proper credentials and selected correct data center while creating connection to the server and i am able to see the java cloud service console with the same credentials. could you please help me on this.?


    Thanks
    Kotresh

    ReplyDelete