Deploy Oracle ADF Essentials web application on Tomcat image

Deploy Oracle ADF Essentials web application on Tomcat

Although deployment of Oracle ADF 11g web applications on Tomcat is not officially supported, we have successfully deployed several ADF 11g applications on Tomcat 6. In fact, once you know which adjustments need to be made, it is easy to deploy an ADF application on Tomcat. This post will show you how it can be done and includes a small app which lets you browse departments in Oracle’s sample HR-schema.

Preparation

First, prepare a Tomcat 6 environment for running ADF applications. This post explains how this can be done. The main steps are:

  1. Add all necessary libraries (.jar files) to Tomcat’s lib directory
  2. Add the Oracle data sources needed by your ADF application

Adjust ADF application for deployment on Tomcat

On Tomcat, we can only deploy a Web archive, so we need to make a .war file. This can be done with a deployment profile on the ViewController part of your project. In this profile we will exclude all library dependencies. Apart from that, we need to remove some lines in the web.xml file of our application: all web application listeners need to be removed, and the lines related to JpsFilter need to be removed.
Below I will explain these steps in detail, using a sample application named ADFOnTomcatDemo, which is available for download.

First of all, we need to get the right data source name. When we make a connection in JDeveloper, named hrDS, the default data source name for our application module will be: java:comp/env/jdbc/hrDS. The resource name in the server.xml of Tomcat will then be: jdbc/hrDS. Check that the application is configured to use the JDBC DataSource:

image

After that, we are going to make a new deployment profile: right click the ViewController part of the project and choose “Project Properties”. Select “Deployment” on the left and click the “New…” button to make a new deployment profile. Choose Profile Type “WAR File” and give it a name, for instance “ADFOnTomcatDemo”. This will also be the default name for our WAR-file, but we can change that later on.

image

After clicking OK, we get into the screen for editing profile properties. In the category “General” we can change the WAR filename. This filename is important, because it will be the root-context for our Tomcat deployment and thus appear in the URL for our application. Check that we have the right name for our WAR file, and also check the file location, because we will copy the war file from here to the Tomcat webapp directory.

image

In this same window, click on ‘Library Dependencies’ and deselect all libraries which will appear on the right side:

image

Then click OK. The deployment profile is ready now.

Next, we will have to make some adjustments in the web.xml file of our project. Double click this file in the WEB-INF folder and expand the Web Application Listeners part. Delete all three entries that appear here.

image

Then, select “Filters” on the left side and delete the JpsFilter entry:

image

That’s all. Save the adjustments and make a war-file, using the deployment profile we just made. For this, right click the “ViewController” part of our project and choose “Deploy” to WAR-file. A WAR-file with the name ADFOnTomcatDemo.war will be made and you will find it in the deploy-directory within the ViewController-directory if you have accepted the default location.

Now we need the stop the Tomcat server, if it’s running, delete the previous entry in the webapps/ folder and put our WAR-file in there.

Start Tomcat and check for the following line in the logging:

image

If there are no error messages, then our deployment succeeded and we can access our page “BrowseDepartments.jsf” at the following URL:

http://localhost:8080/ADFOnTomcatDemo/faces/BrowseDepartments.jsf

provided that Tomcat is running locally and configured at the default port 8080.

This is the result for our sample demo application:

image

The sample application can be downloaded at: ADFOnTomcatDemo.

9 Comments

  1. Gaurav May 5, 2016
  2. Abdul February 20, 2015
  3. Abdul February 19, 2015
  4. kari November 5, 2014
  5. aletoa June 30, 2014
  6. juancll June 11, 2014
  7. juancll June 9, 2014
  8. Deleep January 4, 2014