Java Cloud Service: ADF Web Application

Java Cloud Service (JCS) provides a platform to develop and deploy business applications in the cloud. In Fusion Applications Cloud deployments customers do not have the option to deploy custom applications developed with JDeveloper to ensure the integrity and supportability of the hosted application service. Instead the custom applications can be deployed to the JCS and integrated to the Fusion Application Cloud instance.

This series of articles will go through the features of JCS, provide end-to-end examples on how to develop and deploy applications on JCS and how to integrate them with the Fusion Applications instance.

In this article the goal is to get familiar with the JCS by creating a simple web application and deploying it to the JCS. The content covered here can also be seen in this presentation.


Access to Cloud instance

In order to deploy the application access to a JCS instance is needed, a free trial JCS instance can be obtained from Oracle Cloud site. To register you will need a credit card even if the credit card will not be charged. To register simply click "Try it" and choose the "Java" option. The confirmation email will contain the connection details. See this video for example of the registration.

Once the request is processed you will be assigned 2 service instances; Java and Database. Applications deployed to the JCS must use Oracle Database Cloud Service as their underlying database. So when JCS instance is created a database instance is associated with it using a JDBC data source.

The cloud services can be monitored and managed through the web UI. For details refer to Getting Started with Oracle Cloud.


JDeveloper contains Cloud specific features related to e.g. connection and deployment. To use these features download the JDeveloper from JDeveloper download site by clicking the “Download JDeveloper for ADF deployment on Oracle Cloud” link, this version of JDeveloper will have the JCS integration features that will be used in this article. For versions that do not include the Cloud integration features the Oracle Java Cloud Service SDK or the JCS Java Console can be used for deployment.

For details on installing and configuring the JDeveloper refer to the installation guide.

For details on SDK refer to Using the Command-Line Interface to Monitor Oracle Java Cloud Service and Using the Command-Line Interface to Manage Oracle Java Cloud Service.

Access to a local database

The database associated with the JCS instance cannot be connected to with JDBC. Since creating ADFbc business component requires a JDBC connection we will need access to a local database.

Create Application

First Fusion Web Application is created and configured. Start JDeveloper and click “New Application”:

  • Application Name: JcsDemo
  • Application Package Prefix: oracle.apps.jcs.test
  • Application Template: Fusion Web Application (ADF)

Configure Database Connections

To configure connections navigate “View -> Database -> Database Navigator”:

Configure Local Database Connection

The local database will be used to store the data model against which the ADFbc objects are generated. Right click the application name and choose “New Connection”:

In the “Create Database Connection” window opened enter the connection details to your local database, once done you can expand the local database connection node to view objects in the local database:

Configure Database Cloud Connection

The cloud database will be used as the target to which the data model and data is migrated to. On the “Database Navigator” right click the “Cloud Connections” and choose “New Cloud Connection”:

On the “New Cloud Connection” screen enter the data as follows:

  • Database username: user name you login to your JCS instance with
  • Database URL: Obtain value from the "Oracle Database Cloud Service Detail" under “Service Instance URL”
  • SFTP username: Obtain value from the "Oracle Database Cloud Service Detail" under “Service SFTP User Name”
  • SFTP hostname: Obtain value from the "Oracle Database Cloud Service Detail" under “Service SFTP Host & Port
  • SFTP port : Obtain value from the "Oracle Database Cloud Service Detail" under “Service SFTP Host & Port

Once done you can expand the cloud database connection node to view objects in the local database (when prompted enter the password that you use for signing into the JCS):

Configure Cloud Application Server Connection

To configure connection navigate "View -> Application Server Navigator "

The application server connection will be used to deploy the application from JDeveloper to JCS. Right click the application name and choose “New Application Server”:

On the wizard for the application server creation enter data as follows:

  1. Usage: select "Standalone Server"
  2. Name and Type: For connection type select "Oracle Cloud". Name can be anything in example case I used “JCS”
  3. Authentication: For the username and password enter the account used to login to JCS
  4. Configuration: Enter:
  • Data Center; data center hosting the JCS instance provided in the confirmation email
  • Identity Domain; identity domain provided in the confirmation email for the JCS instance email
  • Service Name; Obtain value from the Java Console under "Details -> Service Name"
Once done you can expand the cloud application server connection node to view objects in JCS:

Creating Business Objects

While JCS application can be created without a local database, the local database is required when using ADFbc objects as the JDeveloper cannot use the Database Cloud Service connection to create the ADFbc objects. A common flow for creating the data model is:

  1. Use JDeveloper (or other tools) to create the data model in a local database. The data model in the local database is considered the "source of truth".
  2. Use JDeveloper to generate the ADFbc objects from the data model in local database
  3. Use JDeveloper Data Cart feature to migrate the data model (and data if needed) from the local database into the Database Cloud Service

Alternatively the same can be achieved by manually storing and running scripts, however the above provides convenience by automating the migration.

While not covered in this example developer may choose to also extract the data model into SQL scripts and store the scripts in a separate project in your workspace. There scripts can then be used for backup and need to be regenerated whenever the data model is changed

Creating Data Model

Next data model and data are created for the application. Navigate to “View -> Database -> Database Navigator”, right click on “Tables” node and choose “New Table”:

On the “Create Table” screen enter details for the table to be created. In the example we create table “JCS_DEMO” with two columns; KEY (primary key, VARCHAR 30) and VALUE (VARCHAR 100 not null).

Once table created data can be entered; double click the “JCS_DEMO” table, choose the “Data” tab and click the create button to create a new row:

Migrate Data Model

In order to use run our application in JCS the data model needs to be migrated to the Cloud Database. Open “Database Cart” by navigating “View –> Database -> Database Cart”. Data model and its data are migrated between database instances using the database cart:

Next navigate to the table to be migrates on the source database. In this example the table to be migrated is “JCS_DEMO” in the local database, right click and choose “Add To Cart”:

Select the “Data” check box in the Cart for the table to also migrate the data. Once ready click the “Deploy Cloud” icon:

On the “Deploy Objects to Cloud” most of the parameters are populated from the cloud connection selected as target:

Enter “Title” and the “SFTP password”, note that if you do not know the password you can set it in the Identity Console. Also note that in some system the sftp port may be 2222 even if listed as 22 on the details UI.

Creating ADFbc objects

Choose the “Model” project and navigate “New -> Business Tier : ADF Business Components : Entity Object”. On the “Initialize Business Components Project” choose the local database connection created in previous step. On Step 1 enter “JCS_DEMO” on the “Schema Object” and “JcsDemoEO” on the “Name”:

On steps 2, 3 and 4 accept defaults and click “Next”. On step 5 check the check boxes for both “Generate Default View Object” and “Application Module”. Enter “JcsDemoVO” for the name of the view object and “JcsDemoAM” for the application name:

Click “Finish” to generate the objects.

Creating UI

Choose the “ViewController” project and navigate “New -> Web Tier : JSF : JSF Page”. On the “Create JSF Page” enter “JcsDemo” as name and ensure that the “Create as XML document (*.jspx)” is checked. Navigate to “Data Controls -> JcsDemoAMDataControl -> JcsDemoVO1”:

Drag & drop the “JcsDemoVO1” inside the “<af:form>” element in the “JcsDemo.jspx” and choose “Form –Z ADF Form”:

On the “Edit Form Fields” screen select the “Include Navigation Controls” check box, this will add buttons to the UI that allow us to navigate between records:

In addition to navigating between the records the application will allow users to insert records. Navigate to -> Data Controls -> JcsDemoAMDataControl -> JcsDemoVO1 -> Operations -> CreateInsert”, drag and drop it to the UI after the navigation buttons as “ADF Button”:

The application will also allow the user to commit and rollback on the UI so navigate to “Data Controls -> JcsDemoAMDataControl -> Operations -> Commit”, drag and drop it to the UI after the navigation buttons as “ADF Button”. Repeat the previous step for Rollback. At this point the application is ready to be tested locally. Navigate to “JcsDemo.jspx”, right click and choose “Run”:

This will start a Integrated WLS server and automatically deploy the application. A browser will open and present the UI:

The data created is automatically queried. New row can be created using the “CreateInsert” button. We can also navigate between the records once several exist and commit / rollback changes.

Deploying to JCS

In this example security is not implement rather anyone can access the application. Security will be covered in future article. To disable authentication navigate to web.xml and add “<login-config/>” to the end:

Since JCS does not allow JDBC connections the AM configuration data source needs to be configured. First go to the Java Console and make note of the name of the data source:

In JDeveloper navigate to “JcsDemoAM”, go to “Configurations” tab, select the “JcsDemoAMLocal” configuration and click edit:

Choose “JDBC DataSource” as the “Connection Type” and “database” as the “Datasource name”:

Now we are ready to deploy the application to JCS.

Deploy to JCS

Choose “Application -> Deploy -> JcsDemo_application1“:

On “Deploy JcsDemo_application1“ screen choose “Deploy to Application Server” and choose the application server connection we created in the beginning for JCS in this example the name was set to “JCS”. Click “Finish” and observe the deployment log which will include the root URL for the application:

Before testing the application observe the status of the application from the Java Console:

When the status has a green arrow the URL to test the application with can constructed from the root URL displayed in the deployment log (or alternatively the “Test Application” link on the Java Console). Append the path of the page to be tested to the root URL, in this example the test URL is:

https://java-[identity domain].java.[data center]

When accessed the same UI is presented as with the local testing:

Configure the Access Url (Optional)

The URL used to access the application by default is long and not user friendly. To make it nicer the web context root on the project can be set by selecting the “ViewController” project and navigating “Application -> Project Properties : Java EE Application”. Set the value of “Java EE Web Context Root” to e.g. “demo”. This value will be used as the web context root after the host and port in the URL instead of the “JcsDemo-ViewController-context-root”:

In addition the “faces/JcsDemo.jspx” part of the URL can be simplified. This can be achieved by setting the welcome page by navigating “web.xml -> Pages -> Welcome Files”. Click the add icon and enter “faces/JcsDemo.jspx”

After these changes the application can be accessed using more user friendly URL:

https://java-[identity domain].java.[data center]


In this article we learned how to build and deploy a simple web application for Java Cloud Service. In future articles various other technologies and features such as security, integration to Fusion Applications etc. will be covered.

Excellent. You cover all the bases.

Posted by C Kutler on October 24, 2014 at 09:09 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Follow us on twitter Fusion Applications Extensibility, Customizations and Integration forum Fusion Applications Dev Relations YouTube Channel
This blog offers news, tips and information for developers building extensions, customizations and integrations for Oracle Fusion Applications.


« November 2015