Deploying Oracle ADF Essentials Applications to Glassfish
- by Shay Shmeltzer
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
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).
Download the Oracle ADF Essentials packaging - this will get you an adf_essentials.zip file.
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
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:
Invoke the admin console of glassfish (http://localhost:4848) and log into your admin account.
Go to Configurations->Server-config->JVM Settings and choose the JVM Options tab
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.
Go into Resources->JDBC->JDBC Connection Pools and click to create a New one
Give it a name and choose the resource type to be javax.sql.XADataSource and choose Oracle as the Database Driver vendor. Click Next
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)
Click Finish
Click Ping to check your connection works.
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.
Get an ADF application going (you can use the regular Fusion Application template for this)
Go into the project properties of your viewController project, under the deployment section click to edit the deployment profile that is defined there.
Go to Platform and choose Glassfish 3.1 from the drop down list. Click ok to go back to your project.
Go to Application -> Application Properties-> Deployment
Go to Platform and choose Glassfish 3.1 from the drop down list. Click ok to go back to your project.
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
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.