Directory structure Apache Tomcat

Deploy ADF essentials app on Tomcat 6.x

Tomcat logo

Recently I gotinvolved in a project where the customer requirement was to deploy an ADF application on Apache Tomcat 6.x. This ADF application would be rolled out with ADF Essentials.  Which OTN describes as following: “Oracle ADF Essentials is a free packaging of key technologies from the Oracle Application Development Framework that can  be used to develop and deploy applications without licensing costs”.  Thus tremendously decreasing operational costs.

The plan of action  was to install and configure Tomcat on a test environment and verify that the application would be successfully deployed and work as designed. The following steps were taken to install Tomcat:

  1. Download and configure Tomcat
  2. Application specific configuration

Tomcat download and configuration

Download the stable version of Tomcat 6.x In our case this was Tomcat 6.0.36. (zip file).
Unzip the downloaded zip file to a folder. We chose to unpack the files in  “/u01/app/apache/apache-tomcat-6.0.36”.

Create a script to set environment variables $CATALINA_HOME and $CATALINA_BASE  pointing to “/u01/app/apache/apache-tomcat-6.0.36” . The two environment variables have the same value because this is a single instance configuration. It is also required to have the $JAVA_HOME environment variable, this will be used by Tomcat to start the application server. I chose to install Java 6 in a custom location.

tomcat web application manager

“Tomcat Web Application Manager” application provides the user with functionality to upload, deploy and undeploy applications through the Web.Also once deployed, to stop and start applications. One can access the “Tomcat Web Application Manager” on the Tomcat server on the following URL: http://[server-hostname]:[server-port]/manager.

You will be asked for username and password. Out of box Tomcat is not shipped with any users. To create an user that can execute deployments, add the following snippet to $CATALINA_BASE/conf/tomcat-users.xml:

<user username=”admin” password=”admin” roles=”standard,manager-gui”/>

There are several shell scripts that need to be executable. We need to adjust the file permissions of these files, execute the following commands at the terminal:

cd $CATALINA_BASE/bin
chmod +x *.sh
 

Application specific configuration

The application we deployed on Tomcat shows data that reside in the database, so we need to configure JDBC resources. In the $CATALINA_BASE/conf/context.xml add the following snippet between the <Context> tag:

<ResourceLink global=”jdbc/webAPP” name=”jdbc/ecccDBDS” type=”oracle.jdbc.pool.OracleDataSource”/>

Then we need to configure the details of this pool. In the $CATALINA_BASE/conf/server.xml add the following snippet between the <GlobalNamingResources> element:

<Resource name=”jdbc/webAPP” auth=”Container”

                type=”oracle.jdbc.pool.OracleDataSource”

                driverClassName=”oracle.jdbc.driver.OracleDriver”

                factory=”oracle.jdbc.pool.OracleDataSourceFactory”

                url=”jdbc:oracle:thin:@server:1521:xe”

                user=”scott” password=”tiger” maxActive=”20″ maxIdle=”10″ maxWait=”300″/>

The developer of the application to be deployed and I realized that it would help us preventing class loading issues if we copied all our java libraries to the server. This would be the “lib” directory in the $CATALINA_BASE. The following files were placed in the $CATALINA_BASE/lib:

adfbcsvc-client.jar
adfbcsvc.jar
adfbcsvc-registration.jar
adfbcsvc-share.jar
adf-businesseditor.jar
adf-businesseditor-model.jar
adf-businesseditor-settings.jar
adf-controller-api.jar
adf-controller.jar
adf-controller-rt-common.jar
adf-controller-schema.jar
adf-controller-security.jar
adf-dt-at-rt.jar
adfdt_common.jar
adf-dynamic-faces.jar
adf-faces-changemanager-rt.jar
adf-faces-databinding-dt-core.jar
adf-faces-databinding-rt.jar
adf-faces-registration.jar
adf-faces-templating-dt-core.jar
adf-faces-templating-dtrt.jar
adflibfilter.jar
adflibrary.jar
adf-loc.jar
adflogginghandler.jar
adfm-debugger.jar
adfm.jar
adfmportlet.jar
adfm-sqldc.jar
adfmweb.jar
adf-pageflow-dtrt.jar
adf-pageflow-fwk.jar
adf-pageflow-impl.jar
adf-pageflow-rc.jar
adf-richclient-api-11.jar
adf-richclient-automation-11.jar
adf-richclient-impl-11.jar
adf-runtime-mbean.jar
adf-sec-idm-dc.jar
adf-share-base.jar
adf-share-ca.jar
adf-share-glassfish.jar
adfsharembean.jar
adf-share-security.jar
adf-share-support.jar
adf-share-web.jar
adftags.jar
adftransactionsdt.jar
adf-view-databinding-dt-core.jar
annotations-api.jar
bc4jhtml.jar
bc4jimdomains.jar
bc4j-mbeans.jar
bc4jsyscat.jar
bundleresolver.jar
cache.jar
catalina-ant.jar
catalina-ha.jar
catalina.jar
catalina-tribes.jar
com.bea.core.apache.commons.collections_3.2.0.jar
commons-el.jar
datatags.jar
db-ca.jar
dms.jar
dvt-databinding-dt-core.jar
dvt-databindings.jar
dvt-databindings-mds.jar
dvt-facesbindings.jar
dvt-faces.jar
dvt-jclient.jar
dvt-trinidad.jar
dvt-utils.jar
ecj-3.7.2.jar
el-api.jar
facesconfigmodel.jar
glassfish.jstl_1.2.0.1.jar
groovy-all-1.6.4.jar
inspect4.jar
jasper-el.jar
jasper.jar
javamodel-rt.jar
javatools-nodeps.jar
javax.mail_1.1.0.0_1-4-1.jar
javax.transaction_1.0.0.0_1-1.jar
jdev-cm.jar
jewt4.jar
jmxdc.jar
jr_dav.jar
jrf-api.jar
jsf-api.jar
jsf-impl.jar
jsp-api.jar
jsp-el-api.jar
mds-dc.jar
mdsrt.jar
oc4j-ws-support.jar
oicons.jar
ojdbc6dms.jar
ojdl2.jar
ojdl.jar
ojsp.jar
oracle.classloader_11.1.1.jar
oracle-el.jar
oracle.http_client_11.1.1.jar
oracle.logging-utils_11.1.1.jar
oracle-page-templates.jar
oracle.web-common_11.1.1.jar
oracle.xdb_11.1.0.jar
orai18n-mapping.jar
ordhttp.jar
ordim.jar
org.apache.bcel_5.1.jar
org.apache.commons.beanutils_1.6.jar
org.apache.commons.beanutils_1.8.3.jar
org.apache.commons.logging_1.0.4.jar
org.apache.commons.logging_1.1.1.jar
prefuse.jar
rcs-adflib-rt.jar
rcsrt.jar
regexp.jar
resourcebundle.jar
servlet-api.jar
share.jar
taglib.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
trinidad-api.jar
trinidad-impl.jar
velocity-dep-1.4.jar
weld-integration.jar
xmlef.jar
xmlparserv2_sans_jaxp_services.jar

Now we will adjust the memory settings. This is to accommodate all the jar files that may be referenced later on. Edit the $CATALINA_BASE/bin/catalina.sh and add the following line above the alreay existing text “#OS specific support…..”

CATALINA_OPTS=”-Xms1024m -Xmx1024m -XX:MaxPermSize=512m”

At this point the application server is configured and prepared for the application deployment.

Make sure that there are no libraries in the deployment war file, otherwise weird class loading issues may occur. The application should be exported to use the datasource/JDBC resource on the application server, and no hard coded jDBC URL. You can launch Tomcat by executing the following shell script: $CATALINA_HOME/bin/startup.sh

Deploy ADF essentials app on Tomcat 6.x application status

Login to the “manager” application and drag and drop the application on the “Choose file” button inside the “War file to deploy” section. After a successful deployment the application will be started and the Running column for your application will have the status “true”.

When facing problems analyze the log files that can be found in the server directory: $CATALINA_BASE/logs. In our situation the log file “localhost” had the most accurate logging for the exceptions we had.

Cheers!

One Response

  1. Lucas Jellema December 3, 2012