Deploying Oracle ADF Essentials Applications to Glassfish

Posted by Shay Shmeltzer on Oracle Blogs See other posts from Oracle Blogs or by Shay Shmeltzer
Published on Mon, 24 Sep 2012 17:06:18 +0000 Indexed on 2012/09/24 21:44 UTC
Read the original article Hit count: 262

Filed under:

With the new Oracle ADF Essentials offering you can now deploy applications that leverage Oracle ADF on the open source Glassfish 3.1 server.

Deployment is documented in the official JDeveloper and ADF documentation (here) but below is a summary of the steps and a video of the steps you'll need to take to get a basic Oracle ADF Essentials application to work on GlassFish.

Note - to make starting/stopping GlassFish easier for my demo I used my GlassFish extension that you can get here.

First we'll install some ADF Runtime libraries on GlassFish

  1. Download and install Glassfish (Note - if you also have an Oracle DB on the same machine, you'll want to switch GlassFish's HTTP port to something else instead of 8080).
  2. Download the Oracle ADF Essentials packaging - this will get you an adf_essentials.zip file.
  3. Copy the adf_essentials.zip to the lib directory of your Glassfish domain - on a default windows install this would be: C:\glassfish3\glassfish\domains\domain1\lib
  4. Go the the above lib directory and issue a unzip -j adf_essentials.zip

This will extract the ADF libraries to the directory. Now you can start the Glassfish server.

Now let's configure Glassfish to handle applications of the ADF type:

  1. Invoke the admin console of glassfish (http://localhost:4848) and log into your admin account.
  2. Go to Configurations->Server-config->JVM Settings and choose the JVM Options tab
  3. Add the following entries:
    • -XX:MaxPermSize=512m (note this entry should already exist so just make sure it has a big enough value)
    • -Doracle.mds.cache=simple

While we are in the admin console, we can also define JDBC connections that will be used by our application.

  1. Go into Resources->JDBC->JDBC Connection Pools and click to create a New one
  2. Give it a name and choose the resource type to be javax.sql.XADataSource and choose Oracle as the Database Driver vendor. Click Next
  3. Scroll down to the Additional Properties section and start filling in the information for your database. The values for an Oracle XE will be (user=hr, databaseName = XE, Password=hr, ServerName=localhost, DriverType=thin, PortNumber=1521)
  4. Click Finish
  5. Click Ping to check your connection works.
  6. Now define a new JDBC Resource that will use the pool you just defined. In my example I called the resource jdbc/HRDS

You will need this name to match the name in your Application Module connection configuraiton.

Now you can re-start the Glassfish server for the changes to take effect.
  1. Get an ADF application going (you can use the regular Fusion Application template for this)
  2. Go into the project properties of your viewController project, under the deployment section click to edit the deployment profile that is defined there.
  3. Go to Platform and choose Glassfish 3.1 from the drop down list. Click ok to go back to your project.
  4. Go to Application -> Application Properties-> Deployment
  5. Go to Platform and choose Glassfish 3.1 from the drop down list. Click ok to go back to your project.
  6. This step will make sure that JDeveloper will autoamtically add the necessary ADF libraries to the EAR file that is being generated for deployment on Glassfish
  7.  Go to your Application->Deploy and deploy either to an EAR file or directly to a Glassfish server connection that you created.

Things should just work, but if they don't then look up the server.log in the log directory and check out what error is in there.

Here is a video demo of the various steps:

Note - right now the deployment of an ADF application takes about 2 minutes on my machine we are hoping to be able to improve this timing in the future. People who are more familiar with Glassfish might want to explore using exploded directory deployment and see if they can get it to work.

© Oracle Blogs or respective owner

Related posts about /Oracle/JDeveloper