I finally managed to deploy my application into Tomcat 6.0.18.
I still have the issue of the "sortMode" attribute of my pivotTable been refused by Tomcat JSP compiler so I found a workaround by removing it from my JSP page and set it into my managed bean.
Here how I did it:
First of all, here a description of my application:
This a a web application using ADF components, mainly InputText, commandButton, table, popup, chooseDate, inputDate, selectManyShuttle, selectOneChoice and DVT pivotTable.
I'm also using backing beans, managed beans with view and session scopes.
My application have:
- a"OracleModel" project binded to a Oracle 10g DB using Entities and VO object to create, update delete Data from Oracle tables.
- a "SQLServerModel" project binded to a SQLServer using only VO objects in readonly mode.
- a "View" project containing all JSP, beans.
I created an extra project called "TomcatLibraries" which I use to package all my needed libraries to install on Tomcat.
Into this project I added into the "Libraries and ClassPath" tab of the "Project Properties" all the libraries existing into my "View" project.
This allow me to get all needed jars without spending time to look for them into all Jdev folders. I got this from Terry Cho's blog
http://javamaster.wordpress.com/category/java-programming/
I added those extra jar files into it since Tomcat seems to need them:
- jrf-api.jar (found in MIDDLEWARE_HOME/jdeveloper/modules/oracle.jrf_11.1.1/)
- javax.transaction_1.0.0.0_1-1.jar (found in MIDDLEWARE_HOME/modules/)
- javax.management.j2ee_1.0.jar (found in MIDDLEWARE_HOME/modules/)
For developement purpose with Jdev I had a public_html/WEB-INF/lib folder into my View" project which contains those Jars:
- sqljdbc4.jar (jdbc to SQLServer)
- jsf-api.jar
- jsf-ri.jar
I created the identical folder into my "TomcatLibraries" and copied those 3 files.
Into the TomcatLibraries Project Properties, Deployment Tab, Edit default JAR Deployment Profile:
- In Web Files Filters, select all jars in WEB-INF/lib
- in WEB-INF/lib Contributors, select all Libraries except JSP Runtime
- in WEB-INF/lib Filters, make sure everything is selected.
Into my OracleModel and SQLServerModel project, I set the path of the JAR file into their default deployment profiles to create the jars into my public_html/WEB-INF/lib folder into my "View" Projects
Go into your Model Project Properties, Deployment Tab, Edit default JAR Deployment Profile and into JAR Options, change the path of the JAR File.
Run the deployement profile of the Model Projects once to create the jars into the View Project.
Into the "View" Project Properties,Deployment Tab, Edit default WAR Deployment Profile and in Profile Dependencies, select the Model JAR deployment profiles... unselect all the rest.
Still in WAR Deployment Profile,
- in Web Files Filters, deselect all Libraries in WEB-INF/lib except Model libraries. select those. Deselect also WEB-INF/classes.
- in WEB-INF/lib Contributors, deselect all Libraries (some you can't because theire grey out.. leave them as it is).
- in WEB-INF/lib Filters, deselect all jars
- In Platform, select Tomcat 6.x as Default Platform.
- In WAR Options, choose where you want your WAR to be created and give the name of the file such as APP_NAME.war. This APP_NAME will be used to access your application on Tomcat such as:
http://TOMCAT_SERVER_IP:TOMCAT_PORT/APP_NAME/faces/home.jspx (usually, Tomcat port is 8080)
Make a full Clean
Make a full Build
Run the View deployment. This will create a WAR file with all your classes, JSPs, XML and your model jar only.
TOMCAT SETUP:
I am using jrmc-3.1.0-1.6.0-windows-ia32.exe as JRE. So I first install it at -YOUR_JRE_HOME-
Unzip Tomcat zip file into wanted location that I call -YOUR_CATALINA_HOME-
NOTICE: Tomcat has only my application deployed into it.
I can't garantee that this will work if other application are deployed. Tomcat Manager app works fine anyway.
Dana SingleTerry's blog helped me alot for this part:
http://blogs.oracle.com/dana/2009/01/how_to_deploy_a_11g_adf_applic_1.html
Into CATALINA_HOME/lib:
created a folder "adf" into the folder CATALINA_HOME/lib
In this "adf" folder, put all adf libraries needed for the application. In my case, here the list of all librairies I needed:
- adf-controller-api.jar
- adf-controller-rt-common.jar
- adf-controller-schema.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-support.jar
- adf-transactions-dt.jar
- adfdt_common.jar
- adflogginghandler.jar
- adfm.jar
- adfmweb.jar
- adfsharembean.jar
- bc4j-mbeans.jar
- bc4jwizard.jar
- bundleresolver.jar
- cache.jar
- com.bea.core.apache.commons.collections_3.2.0.jar
- commons-cli-1.0.jar
- commons-el.jar
- db-ca.jar
- dms.jar
- dvt-databindings.jar
- dvt-faces.jar
- dvt-facesbindings.jar
- dvt-jclient.jar
- dvt-trinidad.jar
- dvt-utils.jar
- fmw_audit.jar
- glassfish.jsf_1.2.9.0.jar
- glassfish.jstl_1.2.0.1.jar
- groovy-all-1.6.0.jar
- identitystore.jar
- inspect4.jar
- jacc-spi.jar
- javatools-nodeps.jar
- javax.activation_1.1.0.0_1-1.jar
- javax.jsf_1.2.0.1.jar
- javax.jsp_1.1.0.0_2-1.jar
- javax.management.j2ee_1.0.jar
- javax.security.jacc_1.0.0.0_1-1.jar
- javax.servlet_1.0.0.0_2-5.jar
- javax.transaction_1.0.0.0_1-1.jar
- jdev-cm.jar
- jewt4.jar
- jmxframework.jar
- jmxspi.jar
- jps-api.jar
- jps-common.jar
- jps-ee.jar
- jps-internal.jar
- jps-unsupported-api.jar
- jrf-api.jar
- jsf-api.jar
- jsf-ri.jar
- jsp-el-api.jar
- ldapjclnt11.jar
- mdsrt.jar
- ojdbc6.jar
- ojdl.jar
- ojmisc.jar
- oracle-el.jar
- oracle.ucp_11.1.0.jar
- oraclepki.jar
- orai18n-collation.jar
- orai18n-mapping.jar
- orai18n-servlet.jar
- orai18n-translation.jar
- orai18n-utility.jar
- orai18n.jar
- org.apache.commons.beanutils_1.6.jar
- org.apache.commons.logging_1.0.4.jar
- osdt_cert.jar
- osdt_core.jar
- osdt_xmlsec.jar
- resourcebundle.jar
- share.jar
- sqljdbc4.jar
- trinidad-api.jar
- trinidad-impl.jar
- wls.jsf.di.jar
- xml.jar
- xmlef.jar
- xmlparserv2.jar
WARNING: due to missing class oracle.adf.controller.security.TaskFlowPermission into the new adf-controller-api.jar (JDev 11.1.1.1.0)
I replace it with the same library from Jdev 11.1.1.0.2 which still has this needed class.
Into CATALINA_HOME/conf:
file context.xml:
added those two lines into Context:
<ResourceLink global="jdbc/ConnectionOracleDS" name="jdbc/ConnectionOracleDS" type="oracle.jdbc.pool.OracleDataSource"/>
<ResourceLink global="jdbc/ConnectionSQLServerDS" name="jdbc/ConnectionSQLServerDS" type="javax.sql.DataSource"/>
file catalina.properties:
replace the line:
common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
with the line:
common.loader=${catalina.home}/lib/adf,${catalina.home}/lib/adf/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
This allow to load adf libraries before tomcat libraries since it caused some Exception when compiling JSP (I dunno why)
file server.xml:
I added the Database resource into the GlobalNamingResources:
<Resource auth="Container"
name="jdbc/ConnectionOracleDS"
type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@-IP_DATABASE_ORACLE-:1521:ORCL"
user="-ORACLE_DB_USER-"
password="-ORACLE_DB_PASSWORD-"
databaseName="ORCL"
port="1521"
maxActive="20" maxIdle="2" maxWait="5000"/>
<Resource auth="Container"
name="jdbc/ConnectionSQLServerDS"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://-IP_DATABASE_SQLSERVER-:-PORT_DATABASE_SQLSERVER-;database=-DATABASE_NAME_SQLSERVER-"
username="SQLSERVER_DB_USER"
password="SQLSERVER_DB_PASSWORD"
maxActive="20" maxIdle="2" maxWait="5000"/>
where
-IP_DATABASE_ORACLE- is the IP of the oracle database
-ORACLE_DB_USER- is the oracle database user
-ORACLE_DB_PASSWORD- is the oracle database password
-IP_DATABASE_SQLSERVER- is the IP of the sqlserver database
-PORT_DATABASE_SQLSERVER- is the port of the database (usually 1433)
-DATABASE_NAME_SQLSERVER- is the schema of the database
-ORACLE_DB_USER- is the sqlserver database user
-ORACLE_DB_PASSWORD- is the sqlserver database password
Into CATALINA_HOME/bin:
I created my own Tomcat startup and shutdown .bat:
mystartup.bat:
set CATALINA_HOME=-YOUR_CATALINA_HOME-
set JRE_HOME=-YOUR_JRE_HOME-
set JAVA_OPTS=-Dfile.encoding=utf8
%CATALINA_HOME%\bin\startup.bat
same for myshutdown.bat:
set CATALINA_HOME=-YOUR_CATALINA_HOME-
set JRE_HOME=-YOUR_JRE_HOME-
%CATALINA_HOME%\bin\shutdown.bat
Into CATALINA_HOME/bin:
Create a folder "config" and put in it the file jps-config.xml which looks like:
<?xml version = '1.0' encoding = 'Cp1252'?>
<jpsConfig xmlns="http://xmlns.oracle.com/oracleas/schema/11/jps-config-11_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/11/jps-config-11_1.xsd">
<propertySets/>
<serviceProviders>
<serviceProvider class="oracle.security.jps.internal.credstore.ssp.SspCredentialStoreProvider" name="credstore.provider" type="CREDENTIAL_STORE">
<description>Credential Store Service Provider</description>
</serviceProvider>
</serviceProviders>
<serviceInstances>
<serviceInstance provider="credstore.provider" name="credstore">
<property value="./" name="location"/>
</serviceInstance>
</serviceInstances>
<jpsContexts default="-APPLICATION_NAME-">
<jpsContext name="-APPLICATION_NAME-">
<serviceInstanceRef ref="credstore"/>
</jpsContext>
</jpsContexts>
</jpsConfig>
where
-APPLICATION_NAME- is the JDeveloper application name
I dunno why but if I don't create this folder and file, When deploying my application, I have a FileNotFoundException because it can't find this file into this particular folder.
I searched into this forum and in Google but coud'nt find a way to avoid that right now.
I created the folder and put my jps-config.xml file into it as a workaround for now on.
Start Tomcat with mystartup.bat
when Tomcat correctly started, put your app WAR file intoCATALINA_HOME/webapps and wait until Tomcat auto deploy it.
Check your app with the URL:
http://TOMCAT_SERVER_IP:TOMCAT_PORT/APP_NAME/faces/home.jspx (usually, Tomcat port is 8080)
where APP_NAME is the file name of your WAR file (without the .war of course *grin*)
Here we go..
I haven't tested all possibilities, may be sometimes I'm doing useless stuff ... it is just I spent lots of time trying various things that I lost track of what I should really do (also sometimes forgot why I should do it *grin*) and what was useless.
I also explained SQLServer configuration to show that Tomcat + SQLServer + JDev works fine.
Anyway, this works for me so I hope this will help few of you.
Don't hesitate for questions or more info if I can help you.
Jack