Wednesday, February 26, 2014

How to Deploy ADF application on Tomcat 7 application server

DEPLOY ADF FACES APPLICATION ON   TOMCAT 7.0


Oracle released a few days ago ADF Essentials, which is a free version of its Oracle ADF Framework.
Before we start, you should download the files:
ADF essentials of the required version.
Now the deployment can be divided into 2 stages:
Stage 1: Creating appropriate .war file of the application
Stage 2: Configure Tomcat server.


Stage 1: Create War file

Right click on the view controller part of the project and go to project properties.
Go to deployment and select new option.
Select the profile type as WAR file.

Now we have to make some changes in these options as follows:
Go to Library Dependencies and unselect all the libraries.

Go to platform and select Tomcat 6.x as the default platform.
Click ok.
This creates the deployment profile.









Now go to web.xml of the project. From applications go to “Web Application Listeners” and delete all the present listeners.      
 


Now go to filers and delete the JpsFilter.

Done then. Save all.
Right click on the view-controller and from deploy select the newly created deployment profile.

Select Deploy to WAR.
Wait for the deployment to finish.
Done. The WAR file would be created in %project%/view-controller/deploy/ folder.
Stage 2: Configure Tomcat Server:
Go to Application Module of the project. Go to configurations and click edit on the application and find the Jdbc URL :
Make sure that the connection type is JDBC DataSource in both the local application module and shared application module.
We require only the last part of the URL i.e here jdbc/dbconnDS.
Open the file %TOMCAT_HOME%\bin\catalina.bat (or .sh if you’re in linux environment) and add in the end of the line ‘set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%’ this -Xms1024m -Xmx1024m

Edit /config/context.xml file from tomcat server.
add resource link.
<ResourceLink global="jdbc/dbconnDS" name="jdbc/dbconnDS"
type="javax.sql.DataSource"/>

<Resource name="jdbc/dbconnDS" auth="Container"
              type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
                                                  url="jdbc:oracle:thin:enonew2/enonew2@192.168.10.172:1521:XE"
              maxActive="20" maxIdle="10"
              maxWait="-1"/>
           

Edit /conf/server.xml
Add data ressource node

 <GlobalNamingResources>
 <Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase" description="User database that can be
updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml"/>
<Resource name="jdbc/dbconnDS" auth="Container"
type="oracle.jdbc.pool.OracleDataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@192.168.10.172:1521:XE" user="enonew2" password="enonew2" maxActive="20"
maxIdle="10" maxWait="-1"/>
 </GlobalNamingResources>


Add all the following libraries to %CATALINA_HOME%/lib folder:
Extract ADF Essentials zip file inside the %TOMCAT_HOME%\lib
Also add the remaining libraries.
The lib folder should contain the following 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-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
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-security.jar
adf-share-support.jar
adf-share-web.jar
adf-view-databinding-dt-core.jar
adf-view-unified-databinding-dt-core.jar
ojdl2.jar
oracle-el.jar
oracle.classloader_11.1.1.jar
oracle.external.jsf-ri-20.jar
oracle.http_client_11.1.1.jar
oracle.logging-utils_11.1.1.jar
 xml-apis-ext.jar
xmlef.jar
xmlparserv2_sans_jaxp_services.jar
xsqlserializers.jar
tomcat7-websocket.jar
trinidad-api.jar
trinidad-impl.jar
velocity-dep-1.4.jar
websocket-api.jar
wls-api.jar
xercesImpl.jar
mdsrt.jar
oc4j-ws-support.jar
oicons.jar
ojdbc6.jar
ojdbc6dms.jar
ojdl.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
tomcat-jdbc.jar
tomcat-util.jar







adf.constants.jar
adfbcsvc-client.jar
adfbcsvc-registration.jar
adfbcsvc-share.jar
adfbcsvc.jar
adfdt_common.jar
adflibfilter.jar
adflibrary.jar
adflogginghandler.jar
adfm-debugger.jar
adfm-sqldc.jar
adfm.jar
adfmportlet.jar
adfmweb.jar
adfsharembean.jar
adftags.jar
adftransactionsdt.jar
annotations-api.jar
batik-anim.jar
batik-awt-util.jar
batik-bridge.jar
batik-codec.jar
batik-css.jar
batik-dom.jar
batik-ext.jar
batik-extension.jar
batik-gui-util.jar
batik-gvt.jar
batik-parser.jargroovy-all-1.6.4.jar
identitystore.jar
inspect4.jar
jasper-el.jar
jasper.jar
javamodel-rt.jar
javatools-nodeps.jar
javax.management.j2ee_1.0.jar
javax.transaction-1.0.0.0_1-1.jar
jdev-cm.jar
jewt4.jar
jms-jmx.jar
jmxdc.jar
jmxframework.jar
jmxspi.jar
jps-api.jar
jps-common.jar
jps-ee.jar
jps-internal.jar
jps-unsupported-api.jar
jrf-api.jar
jr_dav.jar
jsf-api.jar
jsf-impl.jar
jsp-api.jar
jsp-el-api.jar
jstl.jar
jta.jar
log4j-1.2.17.jar
mail.jar
mds-dc.jar


batik-script.jar
batik-svg-dom.jar
batik-svggen.jar
batik-swing.jar
batik-transcoder.jar
batik-util.jar
batik-xml.jar
bc4j-mbeans.jar
bc4jhtml.jar
bc4jimdomains.jar
bc4jsyscat.jar
bundleresolver.jar
cache.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
catalina.jar
commons-el.jar
datatags.jar
db-ca.jar
dms.jar
dvt-basemaps.jar
dvt-databinding-dt-core.jar
dvt-databindings-mds.jar
dvt-databindings.jar
dvt-faces.jar
dvt-facesbindings.jar
dvt-jclient.jar
dvt-trinidad.jar
dvt-utils.jar
ecj-4.2.2.jar
el-api.jar
facesconfigmodel.jar
fmw_audit.jar
glassfish.jstl_1.2.0.1.jar oracle.web-common_11.1.1.jar
oracle.xdb_11.1.0.jar
oraclepki.jar
oraclexsql.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
osdt_cert.jar
osdt_core.jar
prefuse.jar
rcs-adflib-rt.jar
rcsrt.jar
regexp.jar
resourcebundle.jar
servlet-api.jar
share.jar
standard.jar
taglib.jar
tomcat-api.jar
tomcat-coyote.jar



After all these steps copy the WAR file of the project to WEBAPPS folder in Tomcat.
And start the server.



Note:
Some solved exceptions:
1)If on deploying the first time it gives exceptions like :
ADFLifeCycle Exceptions
Or some type cast exception



Then put/remove a unused file into the war file (say a blank document) and let the tomcat environment automatically redeploy the WAR file again.










2)If deployment gives the following Exception:
SEVERE : error FilterStart

Then go to the  %CATALINA_HOME%\webapps\%WAR_FILE_NAME%\WEB-INF
Edit web.xml
And remove the filter tags and filter-mapping tags containing “JpsFilter”


Reference: Praful Kamat