Thread: Howto: Deploy ADF application on Tomcat 5.5 using JNDI


Permlink Replies: 7 - Pages: 1 - Last Post: Mar 26, 2008 6:28 AM Last Post By: economist
wveltmaa

Posts: 5
Registered: 02/11/00
Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Nov 18, 2005 2:24 AM
Click to report abuse...   Click to reply to this thread Reply
You installed:
Tomcat 5.5 (with extra admin utility)
Oracle XE
JDeveloper 10.1.2

Let me first suggest backing up the server.xml configuration file of Tomcat 5.5 because that got corrupted several times during restarting Tomcat 5.5. Or just the entire Tomcat 5.5 directory with exception of the temp directory.

You've created a ADF application in JDeveloper. It runs normally in your internal OC4J server. But you now want to deploy it to Tomcat 5.5 and use JNDI.

Place this context.xml file in a META-INF directory in your webroot and deploy it together with your application (war file). This will be used by Tomcat to configure the deployed application and create a JNDI database connection for that application.

<?xml version="1.0" encoding="UTF-8"?>
<Context
antiJARLocking="true"
antiResourceLocking="true"
reloadable="true">
<Resource
auth="Container"
name="jdbc/OracleDS"
type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
driverClassName="oracle.jdbc.driver.OracleDriver"
maxIdle="2"
maxWait="5000"
validationQuery="select sysdate from dual"
url="jdbc:oracle:thin:scott/tiger@localhost:1521:XE"
maxActive="10"/>
<Manager
className="org.apache.catalina.session.PersistentManager"
saveOnRestart="false"/>
</Context>

Mind you that this will create a <webroot>.xml file in .\conf\Catalina\localhost directory.
For more details see Tomcat 5.5 documentation on how to fine-tune your context.xml file. In this case I added some extras to enable redeployments without locking of files and having to restart Tomcat.
You can create a server wide JNDI entry if you want to avoid username/password being distributed in your war file. Mind you with the current admin configuration (which is seperate from Tomcat installation nowadays) you cannot see or edit the JNDI entry with the admin web tool.So editting has to be done manually.

Two main entries are 'type' and 'factory' which were tricky because lack of documentation. In this case they have to be Oracle specific because the internal Tomcat JDBC delegator cannot handle JDBC calls to Oracle the oracle JDBC driver resulting in JBO error types.
I was fortunate enough to find Steve Muench article who wrote about configuring Tomcat 4.x (http://radio.weblogs.com/0118231/stories/2003/08/08/installingTheBc4jToyStoreOnApacheTomcat4124.html) with an explanation about types and factories.
Because of changes in Tomcat 5.x they redefined configuration for JNDI entries so basicly what I did was to remap Steve's suggestions to the new 5.5 structure and using some workarounds. Like using username and password parameters doesn't work so using them in the JDBC url was for me the working solution.

Your project has to be adapted to use JNDI.
Configure your (main) application module by copying the <name>Local configuration into a eg. <name>Tomcat55.
Change connection type in JDBC Datasource and use eg. java:comp/env/jdbc/OracleDS as JNDI name. JNDI naming can get tricky so specifying the full pathname is probably the best way to go. You might use the name parameter of the context.xml file instead.
I didn't test this but it might work.

Configure your databindings file to use this new configuration. (<name>AppModuleDataControl)

Create a deployment profile for the application for Tomcat 5.x where you have to specify the location of your Tomcat webapps directory.

You know should be able to deploy your application to Tomcat 5.5 and test it out.

Good luck!
Shay Shmeltzer

Posts: 9,967
Registered: 03/08/01
Re: Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Nov 18, 2005 10:41 AM   in response to: wveltmaa in response to: wveltmaa
Click to report abuse...   Click to reply to this thread Reply
Thanks for posting this one.
It is always great to see people sharing their knowledge.
madani

Posts: 49
Registered: 02/15/00
Re: Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Nov 20, 2005 12:56 AM   in response to: wveltmaa in response to: wveltmaa
Click to report abuse...   Click to reply to this thread Reply
Thank you for this article.

My question is how different is the deployment described in Steves article from the default deployment ?

What I mean by the default deployment is just dropping the war file under the tomcat webapps folder.I managed to deploy a ADF/Strust/JSP web application without the need to do any configuration ( I am using Tomcat 4.1)

Thank you

wveltmaa

Posts: 5
Registered: 02/11/00
Re: Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Nov 21, 2005 1:04 AM   in response to: madani in response to: madani
Click to report abuse...   Click to reply to this thread Reply
In JDeveloper it's possible to create a Tomcat 5.x deployment profile.
It does copy the war file to the specified Tomcat webapps directory.
Not that much different from copying it by hand or using an ant script.
But this case saves you 1 step. ;)
And every deployment will be copied into the temp directory and installed as the new application. So emptying the temp directory once in a while might be needed as well. (Or there is a deployment directive for doing this automaticly?)

In addition a college of mine tried a global JNDI connection successfully (Server based instead of application based).
You can copy the xml based connection into the server.xml file in the config directory.
There is still a need for the full JNDI naming path. And downside is that you cannot see the JNDI connection settings in the Tomcat admin tool.
javaX

Posts: 445
Registered: 02/11/06
Re: Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Mar 4, 2006 9:26 PM   in response to: wveltmaa in response to: wveltmaa
Click to report abuse...   Click to reply to this thread Reply
Place this context.xml file in a META-INF directory
in your webroot and deploy it together with your
application (war file). This will be used by Tomcat
to configure the deployed application and create a
JNDI database connection for that application.

is this referring the webroot of Tomcat, or, the webroot of an individual Tomcat app (i.e., /Tomcat/webapps/sampleapp/META-INF/context.xml)?

I have had success in the past placing this right in the web root of the individual app and would like to repeat within JDeveloper, however, I have a silly question - I can't figure out how within the Application Navigator to add a new /META-INF folder - when I right click and press 'New' on the Web Content folder I don't get any options to create a new folder?

jmekala

Posts: 1
Registered: 02/13/02
Re: Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Mar 12, 2008 7:55 PM   in response to: wveltmaa in response to: wveltmaa
Click to report abuse...   Click to reply to this thread Reply
Can you please let me know step by step installation of JDeveloper ADF application into Tomcat 5.5
KdeGraaf

Posts: 490
Registered: 04/10/07
Re: Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Mar 18, 2008 12:49 AM   in response to: jmekala in response to: jmekala
Click to report abuse...   Click to reply to this thread Reply
Hi, I also like to see a more detailed step by step installation process.

I have tomcat on a different pc than my jdeveloper, how can I now make a deployment profile for tomcat?
economist

Posts: 1
Registered: 03/26/08
Re: Howto: Deploy ADF application on Tomcat 5.5 using JNDI
Posted: Mar 26, 2008 6:28 AM   in response to: wveltmaa in response to: wveltmaa
Click to report abuse...   Click to reply to this thread Reply
I did the same configuration..

I tried that configuration and didn't manage to deploy working application under tomcat.
I am using tomcat 5.5.17.
My proect is working with datasources, but on tomcat I still get: oracle.jbo.common.ampool.ApplicationPoolException: JBO-30003 .
My context.xml was firstly in config folder of tomcat, then in META-INF folder.
Database entries in context.xml (host, port,sid, login,pwd) are ok.
In Application modules i have full path JNDI name. DataBindings are configured to use propper BC4JDataControls. What else can i do?
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums