For some of our own internal applications, we (AMIS) are using 2 products of Oracle that do not require any license to be payed: ADF Essentials and the Oracle XE database.
These applications were initially deployed to a Tomcat 6 server, only when trying to deploy new applications we encountered issues with conflicting libraries. As the Glassfish Open Source edition is also free and well documented and supported I decided to investigate a switch.
Since ADF Essentials is available more than a year, posts about using ADF Essentials with Glassfish are there already. Take this one for example by Shay Smeltzer. But in these posts there was always something missing, in this post I share the steps I needed for a working deployment to a remote server (in the cloud in my case).
First my assumptions/environment:
- Combination Oracle XE 11g, ADF essentials 11g r2 and Glassfish Open Source Edition 3.1
- The ADF application uses a JDBC datasource
- Glassfish will be running on a server on which the (Oracle XE) database is also running
- The Glassfish Admin console is accessed remotely
Installing and configuring Glassfish
First we check that a JDK 6 or 7 is installed on the server. If not please install JDK 7.
Next we download glassfish.
You need to download the 3.1 Full Platform version!
There is also a complete zipped installation you only need to unzip.
Install Glassfish, a link to the documentation can be found on the download page.
Start the glassfish server. When you use the zip-file you can start the domain using:
You should now be able to start the admin-console in a browser using http://<hostname>:4848/
If you have a database running on the same server you can better change the default http-port. Update the default http-port from 8080 to say 8484:
- Expand folder: Configuration | server-config | HTTP Service | HTTP Listeners | http-listener-2
- Update the port and save
For ADF essentials we need to update two settings:
- Configurations | Server-config | JVM Settings
- choose the JVM Options tab
- Update the following entry:
(note if the value is larger than 512m you can leave it to that)
- Add the following entry:
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
- Create a New one and give it a name
- Choose the resource type to be javax.sql.XADataSource
- 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, Password=hr, url=jdbc:oracle:thin:@hostname:1521:XE)
- Click Finish
- Click Ping to check your connection works.
- Define a new JDBC Resource that will use the pool you just defined, you will need this name to match the name in your Application Module connection configuration.
Downloading ADF Essentials library
Unzip the library in <unzip-directory>/glassfish3/domains/<domain>/lib directory using “unzip -j” (you do not want the directories, only the jar-files).
Restart the glassfish server:
- <unzip-directory>\glassfish3\bin>asadmin stop-domain
- <unzip-directory>\glassfish3\bin>asadmin start-domain
Preparing your application for deployment
- 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 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 automatically add the necessary ADF libraries to the EAR file that is being generated for deployment on Glassfish.
- Go to your Application | Deploy
- Deploy either to an EAR file or directly to a Glassfish server connection that you created.
- An ear-file can be deployed manually in the admin-console by selecting Applications and uploading the ear-file
When running glassfish locally you can also deploy the ear to the domains autodeploy directory
Out-of-the-box, GlassFish Server 3.1 does not permit remote administration. This is to reduce your exposure to an attack from elsewhere in the network. If you try to do remote administration GlassFish sends a “403 – Forbidden” HTTP status as the response.
You can turn remote administration on using
which actually accomplishes two things. It enables remote administration and also encrypts all admin traffic