On Thu, 14 Feb 2002, George M. Coles wrote:
> Date: Thu, 14 Feb 2002 15:53:17 -0500
> From: George M. Coles <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: null DataSource when trying to get JNDI InitialContext
>
> Hi all,
> I am using tomcat for the firs time. I have v. 4.02, using jdk 1.4.
>
> I am attempting to deploy my app, which uses JNDI to look up a connection
> for its data access. I am using DB2 I have placed the db2 jdbc zip file in
> my WEB-INF/libs dir. My server.xml looks like this:
>
> <Context path="/pl" docBase="E:/projects/fa/fa"
>debug="5"
> privileged="true">
> <Resource name="jdbc/PATHLINE" auth="Container"
> type="javax.sql.DataSource" description="Pathline Database">
> <ResourceParams name="jdbc/PATHLINE">
> <parameter>
>
><name>driverClassName</name>
>
><value>COM/ibm/db2/jdbc/app/DB2Driver</value>
> </parameter>
> <parameter>
> <name>driverName</name>
>
><value>jdbc:db2:PATHLINE</value>
> </parameter>
> <parameter>
> <name>user</name>
> <value>db2admin</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>password</value>
> </parameter>
> </ResourceParams>
> </Resource>
> </Context>
>
>
> When I do my context lookup, which should return a DataSource, the
> DataSource is null. I do not, however, get a naming exception, as I would
> expect if the resource could not be found.
>
> Has anyone had a similar experience? I am not quite knowlegeable enough
> about JNDI or Tomcat to see where my problem is.
>
> thanks,
> George Coles
>
The <ResourceParams> element should *not* be nested inside the <Resource>
element. Instead, it should *follow* <Resource> at the same level.
<Context path="..." ...>
<Resource name="..." .../>
<ResourceParams name="...">
... parameter elements ...
</ResourceParams>
</Context>
Craig
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>