Java Mailing List Archive

http://www.junlu.com/

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

JNDI Issue with GlobalNamingResources & DefaultContext Solved

Peter Harrison

2003-12-14


Earlier I had posted messages and bug reports about a change of behaviour
between 4.0.4 and 4.1. Previously I had defined a resource and resource
parameters in the default context. This stopped working in 4.1, and I
couldn't find a way that would allow me to both Autodeploy while keeping the
datasource.

Resources defined in the DefaultContext do not work, while if the same entries
are put into a specific Context they do work.

So what is the fix? Here is what I have done to get things working, including
Autodeploy. Note that this is a fix for V5 - I havn't tried this yet on 4.1.

1. Move the resource and resourceparams to GlobalNamingResources.

2. Create a xml file under $tomcat_home/conf/Catalina/localhost in the name of
the context:

<Context path="/boo" docBase="boo" debug="0" privileged="true">
<ResourceLink name="jdbc/boo"
global="jdbc/boo" type="javax.sql.DataSource" />
</Context>

The context entry will not block the deployment of the application, and the
database will init correctly. Hope this helps people.

Regards,

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.