I was having the same problem, but finally figured it out.
I'm using Tomcat 4.0.1 and accessing my jsp pages through
Apache using the Warp connector. I found it important to
put the JNDI DataSource definition under the correct connector
in the server.xml configuration file. So, to access the
DataSource from a jsp accessed through the Warp connector by
Apache, put the resource-ref in a context under the
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
connector definition of the server.xml config file.

> >     I have a question about how JNDI works in Tomcat 4.0.1
> >     How can i set up a JNDI naming repository in order to create a
> > datasource???
> >
> >     In the server.xml i have this:
> >
> >          <Resource name="jdbc/FtcAppDb" auth="CONTAINER"
> >                     type="javax.sql.DataSource"/>
> >           <ResourceParams name="jdbc/FtcAppDb">
> >
> > <parameter><name>user</name><value>scott</value></parameter>
> >
> >
> > <parameter><name>password</name><value>tiger</value></parameter>
> >             <parameter><name>driverClassName</name>
> >
> > <value>oracle.jdbc.driver.OracleDriver</value></parameter>
> >
> >             <parameter><name>driverName</name>
> >
> > <value>jdbc:oracle:thin:@zagarron:1521:orcl</value></parameter>
> >           </ResourceParams>
> >
> >         Inside de Context tag of my application.
> >
> >         In the web.xml i have this:
> >
> >         <resource-ref>
> >       <res-ref-name>jdbc/FtcAppDb</res-ref-name>
> >       <res-type>javax.sql.DataSource</res-type>
> >  <res-auth>Container</res-auth>
> >     </resource-ref>
> >
> > i get the datasource object doing this :DataSource ds =
> > (DataSource)ctx.lookup("jdbc/FtcAppDb");
> > but when i try to create the connection object i get a Null Pointer
> > exception error

Reply via email to