Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Tomcat 4.1 DefaultContext Bug?

Peter Harrison

2003-08-20

Replies:

I have spent the last three days trying everything to move from 4.0 to 4.1.
The problem is with the datasources. When the resource is in a specific
Context everything works, but when its in the DefaultContext I am getting a

java.sql.SQLException: Cannot load JDBC driver class 'null'

The server.xml has a resource defined:

<Resource name="jdbc/foo" auth="Container" type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/foo">
     <parameter><name>user</name><value>foo</value></parameter>
     <parameter><name>password</name><value>bar</value></parameter>
     <parameter><name>driverClassName</name>
       <value>org.postgresql.Driver</value></parameter>
     <parameter><name>url</name>
       <value>jdbc:postgresql://localhost/foo</value></parameter>
</ResourceParams>

My web.xml now has:

<resource-ref>
   <description>Foo Database</description>
   <res-ref-name>jdbc/foo</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>


The driver is there - since I it works when the Context is specific. The
problem however is that a Context that is specified will block unpacking of a
war. There are some issues with using the war directly without unpacking - so
I need to define the datasource in the DefaultContext. However this isn't
working.

Simply changing from DefaultContext to Context "solves" the problem - proving
that it is the DefaultContext which doesn't appear to work.

Help :)

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.