tags:

views:

522

answers:

5

I have a web application and use tomcat-5.5.27, eclipse 3.4 on open SUSE. I use it from eclipse (deploy, run, debug, etc...) I have to set some JNDI resources (datasources) that Tomcat will expose them. These resources are defined now in \META-INF\context.xml. This works fine.

But, when I move this file (context.xml) in tomcat-5.5.27/conf/context.xml or tomcat-5.5.27/conf/Catalina/localhost/myapp.xml, it does not load the resources defined in the file.

What can be the problem?

My context.xml:

<Context path="/myapp" docBase="/myapp" debug="5" reloadable="true" crossContext="true">

<Resource name="jndi_name" auth="Container"   
    type="javax.sql.DataSource"   
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"      
    driverClassName="COM.ibm.db2.jdbc.app.DB2Driver"
    url="jdbc:path_to_db"
    username="username"
    password="password" 
    validationQuery="SELECT 1 FROM SYSIBM.SYSDUMMY1"         
    defaultTransactionIsolation="READ_COMMITTED"
    removeAbandoned="true" logAbandoned="true" >
</Context>
A: 

If you're using the web tools project feature in Eclipse to manager your Tomcat instance you need to know that it does change Tomcat base directories.

Try using a separate Tomcat install and see if that helps.

Robert Munteanu
A: 

This could be a classpath issue when tomcat comes to load the JDBC driver, (ie. before it loads your webapp).

Do you have the JAR file for the DB2 driver in tomcat-5.5.27/common/lib ? It must be there for the class loader to find it, and not in your webapp's WEB-INF/lib directory.

Lee
A: 

What do the tomcat logs show when you start it up?

That tag is not closed, check if you copied it to question correctly.

objects
+1  A: 

where is your webapp stored ? It's own folder or under webapps ? check if your docBase is valid, if your app is under webapps I don't think you need the "/"

Any relevant info from the Tomcat logs ?

Billy
A: 

Open the tomcat server in the server view, modify anything like the timeout, save it and your context will be recognized.

Rodrigo Asensio