tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graff, David" <david.gr...@cingular.com>
Subject RE: JNDI Problem
Date Tue, 17 Aug 2004 16:14:01 GMT
Temporarily remove the res-ref entry from your web.xml file, and through the
admin console add a resource link to the global resource in the context of
your web app.

Or add manually a resource link entry in your server.xml to the context
entry.

This is an annoying little quirk.

-----Original Message-----
From: Bussie, Andre D [mailto:andre.d.bussie@lmco.com]
Sent: Tuesday, August 17, 2004 11:49 AM
To: tomcat-user@jakarta.apache.org
Subject: JNDI Problem


Trying to set access datasource via JNDI. Using Tomcat 5.0.19 however I
get the following error message

Cannot create JDBC driver of class '' for connect URL 'null', cause:
null

 

Here is my server.xml file snippet

<GlobalNamingResources>

<Resource name="hsqldb" type="javax.sql.DataSource"/>

<ResourceParams name="hsqldb">

      <parameter>

        <name>maxWait</name>

        <value>5000</value>

      </parameter>

      <parameter>

        <name>maxActive</name>

        <value>4</value>

      </parameter>

      <parameter>

        <name>password</name>

        <value></value>

      </parameter>

      <parameter>

        <name>url</name>

        <value>jdbc:hsqldb.hsql://localhost</value>

      </parameter>

      <parameter>

        <name>driverClassName</name>

        <value>org.hsqldb.jdbcDriver</value>

      </parameter>

      <parameter>

        <name>maxIdle</name>

        <value>2</value>

      </parameter>

      <parameter>

        <name>username</name>

        <value>sa</value>

      </parameter>

  </ResourceParams>

 </GlobalNamingResources>

 

Here is web.xml snippet

<!-- JNDI Resource Declarations -->

  <resource-ref>

   <description>Resource reference to a HSQLDB datasource instance

     that is configured in the server.xml file.

   </description>

   <res-ref-name>hsqldb</res-ref-name>

   <res-type>javax.sql.DataSource</res-type>

   <res-auth>Container</res-auth>

  </resource-ref>

 

JSP code to access 

Context initContext = new InitialContext();

Context envContext  = (Context)initContext.lookup("java:/comp/env");

DataSource ds = (DataSource)envContext.lookup("hsqldb");

Connection conn = ds.getConnection();

 

 

I followed the instructions from the tomcat web page what is causing
this and how can I get this resolved to access the datasource through
JNDI. 

 

Anyone .........

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message