2
votes

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>
5
your context is not visible :)Antoine Claval
No way! Do U really think this? Anyway .. tks for your time, but not helping .. at allAndrei

5 Answers

1
votes

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 ?

0
votes

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.

0
votes

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.

0
votes

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

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

0
votes

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