Apache Tomcat is an open source implementation of JSP and Servlet technologies which is used to host wide variety of web applications using Java technologies. It is a web server of choice for people using open source technologies.
So why would you want to create web applications using ADF technology?
- Using JDeveloper and ADF technology it is very easy to create applications which require database interaction. (Creating data bound applications with any other technologies such as JSF, Servlets will definitely take more effort and knowledge). These applications can then be deployed over the internet or can also be deployed to run on a single machine.
So why would you want to use ADF and deploy it on Tomcat rather than Weblogic application server?
- Weblogic is a very heavy application server (plus it requires licenseJ), whereas Tomcat is open source, light weight, easy to deploy and maintain. Tomcat is ideally suited to run web applications on a single machine.
Following contributions available on internet were very helpful while finalizing the steps mentioned below.
These steps were implemented while working with
JDeveloper - version 11.1.2.0.0
Derby – version 10.8.1.2
Tomcat – 7.0.19
Following are the steps
1) The first step is to get all the JAR files which are required for your application to run. As per Oracle’s directory structure, these JAR files are distributed in multiple directories available in the Middleware Home. It is very tedious task to go and manually collect these files, to get all the relevant files in one go the following method can be used.
=> Right click on your ‘ViewController’ project
=> Select ‘Deployment’
=> Select ‘Edit’ (for the default deployment profile that is created)
=> Go to ‘File Groups/WEB-INF/lib/Contributors’
=> Select all the libraries available in the window
=> Go to ‘Platform’, Choose ‘Default Platform’ as ‘Tomcat 6.x’
=> Come back to the main JDeveloper window
=> From the ‘Build’ menu, select ‘Deploy’ and then the default deployment profile that you edited.
=> From the dialog box which opens up choose ‘Deploy to WAR’
=> This will create the WAR file in your JDeveloper ‘ViewController’ project under the ‘deploy’ directory. The WAR file will have all the JAR files that your project needs to run.
=> Create a new directory ‘adf’ under the directory ‘$CATALINA_HOME/lib’
=> Extract the JAR files to the new directory ‘adf’ created in the above step.
Following is the indicative list of the JAR files (your application may not return the same JAR files)
adf-controller-api.jar | adf-controller-rt-common.jar | adf-controller-schema.jar |
adf-controller-security.jar | adf-controller.jar | adf-dt-at-rt.jar |
adf-faces-databinding-rt.jar | adf-pageflow-dtrt.jar | adf-pageflow-fwk.jar |
adf-pageflow-impl.jar | adf-pageflow-rc.jar | adf-richclient-api-11.jar |
adf-richclient-impl-11.jar | adf-share-base.jar | adf-share-ca.jar |
adf-share-security.jar | adf-share-support.jar | adfdt_common.jar |
adflibfilter.jar | adflibrary.jar | adflogginghandler.jar |
adfm-debugger.jar | adfm.jar | adfmweb.jar |
adfsharembean.jar | adftransactionsdt.jar | bc4j-mbeans.jar |
bc4jtester.jar | bundleresolver.jar | cache.jar |
com.bea.core.apache.commons.collections_3.2.0.jar | commons-cli-1.0.jar | commons-digester.jar |
commons-el.jar | db-ca.jar | derby.jar |
derbyclient.jar | dms.jar | dvt-databindings-mds.jar |
dvt-databindings.jar | dvt-faces.jar | dvt-facesbindings.jar |
dvt-jclient.jar | dvt-trinidad.jar | dvt-utils.jar |
fmw_audit.jar | glassfish.el_1.0.0.0_2-1.jar | glassfish.jstl_1.2.0.1.jar |
groovy-all-1.6.3.jar | help-share.jar | identitystore.jar |
idert.jar | inspect4.jar | iText-2.1.7.jar |
jacc-spi.jar | jasperreports-4.0.2.jar | javatools-nodeps.jar |
javatools.jar | javax.activation_1.1.0.0_1-1.jar | javax.mail_1.1.0.0_1-4-1.jar |
javax.mail_1.4.jar | javax.management.j2ee_1.0.jar | javax.management_1.2.1.jar |
javax.security.jacc_1.0.0.0_1-1.jar | jdev-cm.jar | jdev-rt.jar |
jewt4.jar | jmxframework.jar | jmxspi.jar |
jps-api.jar | jps-common.jar | jps-ee.jar |
jps-internal.jar | jps-manifest.jar | jps-unsupported-api.jar |
jrf-api.jar | jrf-client.jar | jrf.jar |
jsf-api.jar | jsf-impl.jar | jsp-el-api.jar |
jstl.jar | ldapjclnt11.jar | mdsrt.jar |
oc4jclient.jar | ohj.jar | ojdbc6.jar |
ojdbc6dms.jar | ojdl.jar | ojmisc.jar |
ojsp.jar | oracle-el.jar | oracle-page-templates-ext.jar |
oracle.ucp_11.1.0.jar | oracle.web-common_11.1.1.jar | oraclepki.jar |
oracle_ice.jar | orai18n-mapping.jar | orai18n.jar |
oramds.jar | org.apache.bcel_5.1.jar | org.apache.commons.beanutils_1.6.jar |
org.apache.commons.digester_1.8.jar | org.apache.commons.logging_1.0.4.jar | osdt_cert.jar |
osdt_core.jar | osdt_ws_sx.jar | osdt_xmlsec.jar |
regexp.jar | resourcebundle.jar | share.jar |
standard.jar | trinidad-api.jar | trinidad-impl.jar |
xercesImpl.jar | xml.jar | xmlef.jar |
xmlparserv2.jar |
|
|
2) Go back to the WAR deployment profile properties ‘File Groups/WEB-INF/lib/Contributors’ and deselect all the libraries that you had selected.
3) Redeploy the WAR file, the size will be considerably less as the JAR files will not be included in this.
4) Change the web.xml file to the one created using older version of JDeveloper (for e.g. JDeveloper 11.1.1.3.0)
5) Comment the JPSFilter related tags in web.xml file
6) Comment the Security related tags in adf-config.xml file.
7) (This step is required only if you are using older version of JDeveloper. In case of JDeveloper 11.1.2.0.0 the connection type is JDBC Datasource by default.) In JDeveloper Model project. Right click on 'AppModule', click 'Configuration's. You will see two configurations 'AppModuleLocal' and 'AppModuleShared'. Edit these two configurations to change the connection type from 'JDBC URL' to 'JDBC Datasource'.
8) In bc4j.xcfg file replace the following tag (difference is in the slash before the word ‘comp’)
<Custom JDBCDataSource="java:comp/env/jdbc/DerbyADFDBDS"/>
with
<Custom JDBCDataSource="java:/comp/env/jdbc/DerbyADFDBDS "/>
Alternatively, the above change can be in JDeveloper itself while you are performing step 6.
9) In $CATALINA_HOME/conf/catalina.properties replace
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
with
common.loader=${catalina.home}/lib/adf,${catalina.home}/lib/adf/*.jar,${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
(Basically, load the ADF classes first and then load the Tomcat classes. In the example above the ADF classes and jars are stored under a new directory "adf" created under ${catalina.home}/lib)
10) In <CATALINA_HOME> directory create a folder "config" and put in it the file jps-config.xml, this file is available in your WAR file.
Edit the version tag in this file to change the encoding from "Cp1252" to "windows-1252"
11) Start Tomcat server. This will automatically deploy your project WAR file.
12) Check the log files created in <CATALINA_HOME>/log directory to check for any errors. If there are any SEVERE errors try to resolve them. The most common error your might encounter is a ClassNotFoundException. Identify the relevant JAR which might be missing and place the same in <CATALINA_HOME>/lib/adf directory. To identify the JAR file name from the class file the site www.findjar.com is very helpful.
13) After the web application is deployed successfully you can access it through the URL
where,
WAR-Name is the name of your WAR file
And
Default-Page is the default page referred to by your Unbounded task flow
For a typical URL will look like