Java – Tomcat does not recognize the context

contextpathjavatomcat

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>

Best Answer

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 ?