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:
- Add all necessary libraries (.jar files) to Tomcat’s lib directory
- 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:
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.
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.
In this same window, click on ‘Library Dependencies’ and deselect all libraries which will appear on the right side:
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.
Then, select “Filters” on the left side and delete the JpsFilter entry:
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:
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:
The sample application can be downloaded at: ADFOnTomcatDemo.
Hi Edward,
Interesting post.
I have tried replicating your post and every time I am getting “Access Denied” on the component area, how ever rest of static content on the page is loading fine.
Any idea what might be going wrong here ?
Cheers,
Hello can please help with this problem….http://stackoverflow.com/questions/28626607/oracle-adf-tomcat-6-x-mysql-5-5-java-lang-abstractmethoderror
Thanks a lot for you post…. Its working….
Thanks a lot for you post EDWARD ORLOWSKI. I configured my tomcat and my application in jDeveloper also.
But we have one problem we are able to run .jsp pages in browser but when we run .jsf page we are unable to see exact output and we are getting the page xml code.
In catalina log file we are getting this warning
Feb 19, 2015 12:10:19 PM org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl getSkin
WARNING: Can’t find a skin that matches family fusionFx and renderkit org.apache.myfaces.trinidad.desktop, so we will use the simple skin
Please help us.
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?
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?
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……
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.
Useful post