You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by pe...@nothingbutnet.co.nz on 2003/01/12 09:23:43 UTC

JNDI Problem under 4.1

I have just installed Tomcat 4.1 - to date I have been using Tomcat 4.0. In 
4.0 I have the following resource in the DefaultContext. I have copied this 
context from the sever.xml of 4.0 to the server.xml of the 4.1 version. 
Otherwise the war I am deploying on both is identical.

<DefaultContext debug="0" reloadable="false">

<Resource name="jdbc/foobar" auth="SERVLET" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/foobar">
<parameter><name>user</name><value>joe</value></parameter>
<parameter><name>password</name><value>bloggs</value></parameter>
<parameter><name>driverClassName</name><value>org.postgresql.Driver</value></parameter>
<parameter><name>driverName</name><value>jdbc:postgresql://localhost/foobar</value></parameter>
</ResourceParams>

</DefaultContext>

In 4.0 everything runs fine, however when I run 4.1 I get the following:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

I did a search on google and there is one instance of something like a fix - 
however it was due to the resource parameters being outside a context. In 
this situation the resource parameters are clearly inside the DefaultContext.

I also did a search of the tomcat list and didn't find an answer. I was 
wondering if I should stick with 4.0, or if there is a simple fix for 4.1?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JNDI Problem under 4.1

Posted by Jacob Kjome <ho...@visi.com>.
Actually, you can define your JNDI Datasource in <GlobalNamingResources> 
and then define a <ResourceLink> inside your context although I would have 
thought that <DefaultContext> would have worked as well?

Jake

At 10:25 PM 1/12/2003 +1300, you wrote:
>On Sun, 12 Jan 2003 21:32, Jacob Kjome wrote:
> > change "user" to "username" and "driverName" to "url"
>
>Did this - but still had the same problem.
>
>A little reading put me right however, as I have now found that the reason 
>was
>that I was attempting to define the context in the <DefaultContext>. This
>appears to work in 4.0, but not in 4.1. Instead you need to specify the
>resource in a specific context, ie:
>
><Context path="/foobar" docBase="foobar" debug="0" reloadable="flase">
>
><Resource name="jdbc/foobar" auth="SERVLET" type="javax.sql.DataSource"/>
>
><ResourceParams name="jdbc/foobar">
><parameter><name>username</name><value>tim</value></parameter>
><parameter><name>password</name><value>password</value></parameter>
><parameter><name>driverClassName</name><value>org.postgresql.Driver</value></parameter>
><parameter><name>url</name><value>jdbc:postgresql://localhost/foobar</value></parameter>
></ResourceParams>
>
></Context>
>
>All appears okay now, thanks for the quick replies,
>Regards,
>
>Peter
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

Re: JNDI Problem under 4.1

Posted by pe...@nothingbutnet.co.nz.
On Sun, 12 Jan 2003 21:32, Jacob Kjome wrote:
> change "user" to "username" and "driverName" to "url"

Did this - but still had the same problem.

A little reading put me right however, as I have now found that the reason was 
that I was attempting to define the context in the <DefaultContext>. This 
appears to work in 4.0, but not in 4.1. Instead you need to specify the 
resource in a specific context, ie:

<Context path="/foobar" docBase="foobar" debug="0" reloadable="flase">

<Resource name="jdbc/foobar" auth="SERVLET" type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/foobar">
<parameter><name>username</name><value>tim</value></parameter>
<parameter><name>password</name><value>password</value></parameter>
<parameter><name>driverClassName</name><value>org.postgresql.Driver</value></parameter>
<parameter><name>url</name><value>jdbc:postgresql://localhost/foobar</value></parameter>
</ResourceParams>

</Context>

All appears okay now, thanks for the quick replies,
Regards,

Peter



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JNDI Problem under 4.1

Posted by Jacob Kjome <ho...@visi.com>.
change "user" to "username" and "driverName" to "url"

Jake

At 09:23 PM 1/12/2003 +1300, you wrote:
>I have just installed Tomcat 4.1 - to date I have been using Tomcat 4.0. In
>4.0 I have the following resource in the DefaultContext. I have copied this
>context from the sever.xml of 4.0 to the server.xml of the 4.1 version.
>Otherwise the war I am deploying on both is identical.
>
><DefaultContext debug="0" reloadable="false">
>
><Resource name="jdbc/foobar" auth="SERVLET" type="javax.sql.DataSource"/>
><ResourceParams name="jdbc/foobar">
><parameter><name>user</name><value>joe</value></parameter>
><parameter><name>password</name><value>bloggs</value></parameter>
><parameter><name>driverClassName</name><value>org.postgresql.Driver</value></parameter>
><parameter><name>driverName</name><value>jdbc:postgresql://localhost/foobar</value></parameter>
></ResourceParams>
>
></DefaultContext>
>
>In 4.0 everything runs fine, however when I run 4.1 I get the following:
>javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
>
>I did a search on google and there is one instance of something like a fix -
>however it was due to the resource parameters being outside a context. In
>this situation the resource parameters are clearly inside the DefaultContext.
>
>I also did a search of the tomcat list and didn't find an answer. I was
>wondering if I should stick with 4.0, or if there is a simple fix for 4.1?
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>