Sunday, December 30, 2012

Managing ADF Applications with Oracle Java Cloud Service Control

In this post I am going to show how to manage and monitor Oracle ADF Applications in the Oracle Cloud using Oracle Java Cloud Service Control.

You should have the following done before trying the described steps in this post yourself.
Managing tasks
The Oracle Java Cloud Service Control - that's the official name - is a subset of Enterprise Manager Cloud Control It supports the Cloud Service Administrator to do the following tasks:
  • View the list of services, metrics and availability of each service instance
  • Deploy / Undeploy / Start / Stop Java EE (ADF) applications
  • View cloud service job logs to see and verify recent activity
  • View and export application log messages
  • View ADF Application performance metrics <<< "does not work for me"
Getting started, Monitor Service Metrics
To get started log in at and open "My Services" tab.

On this screen the first interesting metrics can be monitored per Java service instance.
  • Java Heap usage, averaged over the last 15 minutes
  • CPU usage, averaged over the last 15 minutes

From the service overview we can follow the 'Service Console' Icon that will take us to the 'Oracle Cloud Java Service Control'
The dashboard mainly shows an overview of the service availability and some common used resource usage metrics in different representations (diagram, table) like
  • Active HTTP Sessions
  • Request processing time (in ms)
  • Request count (per minute)
  • Open JDBC Connections
  • Java Heap Usage
  • CPU Usage

Deploy / Undeploy / Start / Stop Java EE (ADF) applications
The next important part is the possibility to Deploy, Undeploy (Delete), Redeploy, Start & Stop Applications. These are common administration tasks which are easy to use without any complications - at least start, stop worked fine so far ;). 

For this post I am going to try deployment of ADF App right from the browser. Let's see if it works (The first ADF Deployment into the Oracle Cloud I have done from JDeveloper IDE, which worked without any problems). So let's click 'Deploy New' 
Choose an EAR from you local machine, give the child a name and press 'Deploy'. 

The upload goes really quick and user is provided with a message which says that a cloud service Job has been started in order to perform the task.
Lesson learned: It is not possible to provide a deployment plan while deploying ADF Applications in the Oracle Cloud.

This brings us to the next feature. 

Cloud service job logs
On the bottom of the cloud control dashboard there is a table panel 'Java Cloud Service Jobs' to track the recent activity. After refreshing the dashboard we notice that the previously started deployment job has failed.

Select the corresponding row and open the 'View Java Cloud Service Job Logs' Menu

The strange thing here (bad UX) is that the service administrator has to guess what actually caused the deployment to fail from 3 options
  • The uploaded EAR might have not passed the virus scan
  • The uploaded ADF Application might have not passed the whitelist validation
  • The deployment failed due to some other issue.
a) For every option you choose from the Menu a file is downloaded and can be viewed on the local machine.
Virus Scan: Passed successful.

b) Next: Application Whitelist Validation
2012-12-29 16:41:23 CST: Starting action "API Whitelist"
2012-12-29 16:41:23 CST: API Whitelist started
2012-12-29 16:41:24 CST: WARNING  - There are 2 warnings(s) found for enpit_cloudapp2.ear.
2012-12-29 16:41:24 CST: WARNING  - Path:enpit_cloudapp2.ear (2 Warnings)
2012-12-29 16:41:24 CST: WARNING   - Path:enpit_cloudapp2.ear (2 Warnings)
2012-12-29 16:41:24 CST: WARNING    - Path:enpit_cloudapp2.war (2 Warnings)
2012-12-29 16:41:24 CST: WARNING     - Path:WEB-INF**** (2 Warnings)
2012-12-29 16:41:24 CST: WARNING      - 1:Recommended child element "jsp-descriptor" missing under element /
               If you have a JSP file that is not pre-compiled, The compilation errors
               could be shown on the browser. It is recommended to include
               <jsp-descriptor><verbose>false<****><****-descriptor> in weblogic.xml.
               Line No:2.
2012-12-29 16:41:24 CST: WARNING      - 2:Recommended child element "session-descriptor" missing under element /
               You will be required to have distinct cookie-path, if multiple
               applications are accessed with in the same SSO session or if you have
               multiple applications with different auth-method(CLIENT-CERT, FORM, BASIC)
                in the same service instance.
               Line No:2.
2012-12-29 16:41:24 CST: WARNING  - enpit_cloudapp2.ear had  2 warning(s).
2012-12-29 16:41:24 CST: INFO     - Whitelist validation has completed with 0 error(s) and 2 warning(s).
2012-12-29 16:41:24 CST: Whitelist validation passed.
2012-12-29 16:41:24 CST: "API Whitelist" complete: status SUCCESS

c) Looks like the deployment actually went wrong - and indeed

2012-12-29 16:41:24 CST: Starting action "Deploy Application"
2012-12-29 16:41:24 CST: Deploy Application started
2012-12-29 16:41:40 CST: weblogic.application.ModuleException:
2012-12-29 16:41:40 CST: WLS action state: failed
2012-12-29 16:41:40 CST: Action FAILED with WLS state: failed
2012-12-29 16:41:40 CST: Application deployment failed.
2012-12-29 16:41:42 CST: [Deployer:149034]An exception occurred for task [Deployer:149026]remove application enpit_cloudapp2 on c1.: .
2012-12-29 16:41:42 CST: WLS action state: completed
2012-12-29 16:41:42 CST: "Deploy Application" complete: status FAILED

=> Well so it looks like an exception occurred while 'removing the application on c1". This message does not help really much, is confusing since that was the first deployment and no need for removing a previous application.

Application log messages
Maybe the log messages give some more information about the failure. The messages are accessible by following the link 'View Log Messages'
Looks like there is a configuration exception in the deployed ADF Application. After deploying the same application from JDeveloper into the Cloud I have noticed the Deployment Platform in the Log was 'Oracle Cloud'. So the problem was clear to me. Open the Deployment Profile and adjust the platform to 'Oracle Cloud' for creating the EAR.
After creating the EAR once again with that setting and performing same steps from the Cloud Control as described above the deployment worked as expected.

Important lesson learned: The Deployment Profiles and so the resulting ADF Application EAR differs.  You cannot use the same EAR for Deployment to on-premise WebLogic Server AND Oracle Cloud Java Service! 

ADF Performance metrics
Clicking on a given ADF applications name shows a dedicated performance view
IMHO the displayed metrics cannot be realtime values because most of the testing time -  there were 2 active HTTP sessions all values were displaying 0. So I guess it is an average view over the last 15 Minutes.

From the application menu the ADF Performance view can be opened.

This part is very disappointing for now since the displayed information is just not true!
The sample app is using an Application Module and so should also display application module pool stats as indicated (but empty :( )

Same to the TaskFlows view
Sample application is using two bounded task flows. So I would expect them to be shown up here.

In general the Java Cloud Service Control makes what it is made for. It looks like the observed shortcomings are a limitation to the trial account or the ADF Performance Summary does not work in its current state. It is interesting to see that even in the official Oracle Cloud Documentation (Sec. Monitoring Oracle Java Cloud Service) there is no word left about the ADF Performance Summary + all available screenshots show 0 sessions, 0 requests and so on.

If someone has a different experience or some guy from Oracle has an explanation for the inconsistent  behavior in the Cloud Service Control feel free to comment. I would be happy to be convinced from the opposite - a reliable cloud service control for monitoring ADF Applications.

Enhancement Requests
  • Java Cloud Service Jobs
    • Emphasize failed jobs, e.g. displaying 'Failed' in Red.
    • In case of failed jobs there should be made clear on first view what caused the issue (Virus detected, Whitelist violated, other issue).
    • Error message in case of failed deployment should be more useful. An message like 'An exception occurred for task [Deployer:149026]remove application enpit_cloudapp2 on c1.: .' does not say anything about the cause.
  • Resource Usage metrics (sessions, Request processing time, JDBC Connections)
    • Realtime Values. Currently it looks like the values are most of the time 0 even if there is some load.
  • ADF Performance 
    • Display the actual metric values. Currently AM Pool and Taskflow metrics are not shown.
  • General: Improved Reliability. Sometime there were just errors and inconsistent information displayed (see next image). E.g. error getting datasources and open JDBC Connections = 0 but the DB based application was accessible and worked fine.


Related Posts

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.
  • 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 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.

  • 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
Everything worked as designed so far. No failure / exceptions occurred to me. Thanks Oracle! Great Work!

Related Posts / Documentation

Saturday, December 1, 2012

Deploying Database Objects to Oracle Cloud using JDeveloper

As announced in my previous post I am going to show now how to deploy Database Objects from a "local" Database to the Oracle Database Cloud. For that showcase I am using the following environment

  • JDeveloper (JDEVADF_11.
  • Oracle XE Database 11gR2 with HR schema
  • Oracle Database Cloud Service
The primary goal is to deploy the tables HR.DEPARTMENTS and HR.EMPLOYEES into the Cloud Schema. So in a next step it will be possible to build an Apex or an ADF Application associated to these tables in the cloud.

Prepare DB Deployment
In order to use the tools provided in JDeveloper for seamless deployment of DB objects into the Oracle Cloud start JDeveloper and open the Database Navigator (View > Database > Database Navigator)

Now create an IDE DB connection to the desired database. I am using the well known HR schema on an Oracle XE DB. This is really straight forward. Just click "+" and add a Database Connection by providing the appropriate account details. Double Click on the created node connects to the database and explores its contents.

Next we need to connect to the Oracle Cloud Database Service. That is pretty simple too.

Enter your cloud service details

et voila, the cloud connection is established!

Important note: Before we go further let me explain the cloud connection details because this is really new and should be noted. The cloud connection actually has two channels. One for "read only" operations and another for DDL, and any SQLPlus scripts. That second channel works technically through SFTP and logically through the "Database Cart" where every db object or script is bundled into a ZIP for sending out to the cloud. Therefor you have to provide that information in the cloud connection wizard.

OK, so the last preparation step is to configure that "Database Cart". Goto: Tools > Preferences >Database > Utitlites > Cart > Cart Deploy and set the deploy directory according to you project needs.

Deploy DB Objects to the Cloud
After establishing the connections and configuring the Database Cart we are ready for deployment. Open Database Cart (View > Database > Database Cart) and Drag and Drop the DB Objects you want to deploy into the database cart.
Next: Click on Save

Click on Apply. 

The selected db objects (metadata) will be saved as an XML File. The Database Cart File contains Metadata about the database objects you want to deploy. To have a better understanding: it looks like that

It is kind of configuration file for the deployment of database objects into the oracle cloud.

Next Step is to deploy the selected DB objects + data into a ZIP file which afterwards will be used to transfer into Oracle Database Cloud.

The ZIP contains the corresponding scripts in order to deploy the objects and data some where else (cloud). Actually it contains a bunch of SQL scripts:

Now the last part is to deploy that ZIP file to Oracle Cloud.

Press Apply.

The data now is exported and transferred as a Deployment Unit on your Database Cloud Service.
You can verify your deployment by refreshing the cloud connection in JDeveloper

and also look into the processing log

The newly created Table DEPARTMENTS can be verified/viewed right from JDevelopers Cloud Connection

Once again - How does it work?
The chosen DB Objects + Data are exported from a database and put together in a file. By providing the SFTP DB Service Account details this file is transferred to the cloud through SFTP. You can verify this by logging into your SFTP Account:

To summarize
  • Configure Database Cart
  • Drag and Drop DB Objects into Database Cart
  • Deploy into Cloud
  • Verify Processing through Deployment Status/ Log
  • Verify deployed DB Objects through Cloud Connection right from the JDeveloper IDE
Having performed this steps next it is possible to build 
  • Apex Application
  • ADF / Java EE Application
  • RESTful Services
based on the deployed data structure. Stay tuned.

I really like that everything is bundled inside JDeveloper. No need to download any plugins or extra tools. Use JDeveloper to Build, Deploy DB and Java Applications (as I will show in the next post). Cool stuff! Goto and try yourself!

Related Posts / Documentation

Friday, November 30, 2012

Oracle Java and Database Cloud Services in Action

Yesterday the long awaited  Oracle Cloud became reality (at least for me)! Thanks Oracle! Of course I could not wait any longer and had to do a test drive with the Oracle Database and Java Cloud Services. In order to start we need the following

Getting started
Once you confirm your activation link for the trial request you will receive an email with Service Details for
  • Identity Domain (which actually is a logical group for associated Users and Cloud Services)
  • Oracle Database Cloud Service
  • Oracle Java Cloud Service
  • Domain FTPs Account Details
In the mail there also will be a temporary password which must be changed after first login at the Identity Console. One thing really overwhelmed me is the fact that for every service you get dedicated user credentials. So there is a lot of stuff that is to be handled.

Identity Domain / Console
The Identity Domain actually is a logical group for associated Users and Cloud Services that is managed by the Identity Domain Administrator. The Identity Console is a web based application for 
  • Manage  User Profile
  • Create / Delete Users, Reset Passwords
  • Create / Delete Roles, Assign to Users
The Identiy Console is build with ADF. It looks like that

Oracle Database Cloud Service 
The Oracle Database Cloud Service runs Oracle DB 11gR2 and is managed by Apex So logically no ADF here. Imagine you are running Oracle XE. Same here.

RESTful Services (by Application Express Listener)
RESTful services are created inside Apex and are delivered right from the Database through the Apex Listener

The defined RESTful Services can be tested right from the browser:

As you can imagine this allows pretty rapid development of RESTful Services! Beside JSON, CSV Format is supported. No XML!

As a sample DB application the following Apex App is installed and by default to demo key features of Oracle Apex! Further Apex applications can be easily deployed from the apex Workspace.

DB Export
In order to export Database strucure + data it is possible to trigger a data pump job with a single Mouse Click. After the job is completed the Dumpfile can be grabbed through SFTP from the /download user directory. The created files are automatically cleaned up after about 2 days. So do not try to archive your data here.

My test worked well without any trouble! The download speed was acceptable to although I did not download Gigs of data.

Access DB Schema
Now let us come to the  interesting part. How can we access the DB Schema from - e.g. SQLDeveloper or JDeveloper. In this case I will demo it from the new JDeveloper (Build 6229) 

In order to access the Database Cloud service from the IDE we need a so called "Cloud Connection User" to be created in the database service console (Apex) with the SQL Developer Group as stated in the JDeveloper context help. This can can be easily done through the Apex Admin Tools (Manage users and groups). I won't go into further details here.

Now it is possible to create the connection from JDeveloper/SQLDeveloper

Enter your service details

and we are up and running, being able to see the structure and contents of the cloud database instance. 

Access for example the table 'DEPT' and browse the data.
(The Tables EMP and DEPT are included in the cloud db schema)

The interesting part here is that it is not possible to change any database objects.

Deploying DB Objects is only possible through the newly introduced "Database Cart" which is accessible from "View > Database > Database Cart". 

That is a very new concept which needs a separate focus. More on that in a follow up post (Deploying Database Objects to Oracle Cloud using JDeveloper). Follow me on twitter to get updated in time (@multikoop)

Oracle Java Cloud Service Control
To monitor, deploy/undeploy start/stop Java and ADF Applications. It looks pretty simple and easy to use: Performance, Data Sources, Applications. Everything you need to get started.

This control is a subset of Oracle Enterprise Manager Cloud Control 12cR2 ( as you can see in the about page.

In one of the next posts I am going to show how to "Deploying ADF Applications into the Oracle Cloud". Stay tuned.


In its current stage Oracle Cloud is promising Cloud Foundation for PaaS and SaaS. It includes
  • Identity Management / WebBased Identity Console (ADF Application)
  • Java Cloud Service Control to Monitor and Deploy your Java Applications (ADF Application)
  • Apex Control to Administer and Monitor Apex DB Applications and Cloud Connection Users
  • IDE Integration in JDeveloper (Build 6229)
  • Oracle Cloud Java SDK Command Line Interface
  • IDE Integration in Oracle Enterprise Pack for Eclipse.
  • IDE Integration in Netbeans is on its way....

Start your cloud experience now! Goto