Deploy Oracle ADF Essentials web application on Tomcat

5

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.

Share.

About Author

5 Comments

  1. Thanks. I would like to use JBoss but have not been able to find instructions for the. Have you tried it or do you have any pointers how adf could work with JBoss?

  2. very useful post, is the only one I found that gave me the correct instructions to configure tomcat with adf
    But now I have a problem with control flow case, I created a simple flow between two pages that works fine into jdeveloper
    But when I try it into the tomcat doesn’t work and doesn’t browse through the pages.
    Anyone have same trick?

  3. hi,
    thanks for the post!!!!!!

    i deployed succefully my demo application adf essentials 11.1.2.3 on tomcat 7.0.47. the application is working fine, but when i try deploy the same application migrated to adf essentials 12.1.2 on the same tomcat 7.0.47 instance the deployment was succefully but at runtime the connection with the database is not working.

    SEVERE: Exception unloading sessions to persistent storage
    JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-30003. Error message parameters are {0=cu.datys.adffacesmasadfmodel.model.AppModuleLocal}
    java.lang.NullPointerException
    at oracle.jbo.server.OracleSQLBuilderImpl.setSessionTimeZone(OracleSQLBuilderImpl.java:5523)
    at oracle.jbo.server.DBTransactionImpl.refreshConnectionMetadata(DBTransactionImpl.java:5398)
    at oracle.jbo.server.DBTransactionImpl.initTransaction(DBTransactionImpl.java:1203)
    at oracle.jbo.server.DBTransactionImpl.initTxn(DBTransactionImpl.java:6932)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:297)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:328)
    at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:202)

    my setenv file for tomcat initial configuration:

    set CATALINA_OPTS=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Doracle.mds.cache=simple -Duser.timezone=”America”

    any idea……

  4. adf app 11.1.2.3 with Adf Model works on tomcat but the same example for adf 12c (with adf essentials 12.1.2) is not working. Only Adf Faces 12c app without Adf Model works good. Please where is an example for 12.1.2 ADF ESSENTIALS on tomcat.

Leave a Reply