Friday, February 1, 2013

Deploy a simple ADF application to Oracle Cloud

I write sample applications to accompany blog posts. You can typically download the project as a zip file or get access to the subversion repository. But I also wanted to make it as easy as possible for people to see the running application. This where the Oracle Cloud comes in. I currently still have a free trial java cloud and this posts explains how I deployed one of the sample applications to that cloud.

First thing you need is the latest version of JDeveloper 11.1.1.6. If you already have JDeveloper installed be sure to check Help > About for the version number. For reasons beyond my comprehension Oracle decided to give the JDeveloper version with cloud support the same version number. The one you need is build 6229 and not the original build 6192:

Get the credentials that you use to logon to your Oracle cloud. This is a username, password and identity domain:
get credentials for oracle cloud

Then we need to register an Application Server connection to the Oracle Cloud with these credentials. From the resource palette (View > Resource Palette) add a new connection:

Be sure to select "Oracle Cloud" as the connection type:
select Oracle Cloud as connection type
;
enter your Oracle Cloud credentials
enter identity domain and name of the service instance
When using a trial cloud instance your service instance is typically called "java". You can see this in your Oracle Cloud dashboard.

I want my applications to be publicly available on the Oracle Cloud and not requiring any logon credentials. To accomplish this add an empty login-config entry to the web.xml file:
  ......
  <!-- empty logon-config to allow anonymous access on Oracle Cloud -->
  <login-config/>
</web-app>

I also added a welcome-file to the web.xml so requests to xxx.oraclecloudapps.com/Application get redirected to xxx.oraclecloudapps.com/Application/faces/defaultPage:
  ......
  <!-- set welcome file so requests to / get redirected to the default page -->
  <welcome-file-list>
    <welcome-file>/faces/demo</welcome-file>
  </welcome-file-list>
</web-app>

If I forgot either of the above steps I would get an Error 403 - Forbidden when trying to access the homepage of my application:
403 error when not disabling security or setting homepage redirect


Now you can deploy from within JDeveloper as you would always do to a remote application server:
deploying the application

log of deploying the application

If you now visit your Oracle Cloud console you can monitor the application and get the URL to run it. (BTW the run URL was also in the deployment log in JDeveloper)
open the java service console from your dashboard

monitor the instance and applications

So here it is my very first live sample application on the Oracle Cloud. It is the sample from a previous blogpost on a DateTimeConverter that accepts dates without separators.

1 comment:

Comments might be held for moderation. Be sure to enable the "Notify me" checkbox so you get an email when the comment is accepted and I reply.