Normally it's

InitialContext initContext=new InitialContext();
DataSource ds = (DataSource) envCtx.lookup("java:/comp/env/jdbc/art");

I have the same problem. I tried to move my ressources declaration from the
context to the <GlobalNamingResources>.
And it doesn't work ???

----- Original Message -----
From: "Roberts, Eric" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Thursday, December 05, 2002 9:45 AM
Subject: RE: java.sql.SQLException: Cannot load JDBC driver class 'null'


Roberto,

How are you instantiating your datasource?

You need something like:

import javax.naming.Context;
import javax.naming.InitialContext;
.
.
.
   ctx = new InitialContext();
   Context envCtx = (Context) ctx.lookup("java:/comp/env/");
   DataSource ds = (DataSource) envCtx.lookup("/jdbc/art");

Hope this helps.

-----Original Message-----
From: Roberto Bouza [mailto:[EMAIL PROTECTED]]
Sent: Mittwoch, 04. Dezember 2002 23:05
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: java.sql.SQLException: Cannot load JDBC driver class 'null'


 Hi.

 I think I have all the configuration fine, but for some reason when my
DBTest
try to get the connection from the DB I only get this:

 ----------------------------- ERRORS start ------------------------

java.sql.SQLException: Cannot load JDBC driver class 'null'
        at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSourc
e.java:529)
        at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j
ava:312)
        at poseidon.ext.DBTest.init(DBTest.java:27)

------------------------------ ERRORS end -------------------------

 What's done:

 1.) In the $CATALINA_HOME/common/lib I have postgresql.jar (PostgreSQL
Driver),
commons-collections.jar, commons-pool.jar, commons-dbcp.jar
 2.) My server.xml:

        --------------- SERVER XML starts ------------------------

       <Resource name="jdbc/art" auth="Container"
type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/art">

  <parameter>
  <name>factory</name>
  <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
  </parameter>

  <parameter>
  <name>driverClassName</name>
  <value>org.postgresql.Driver</value>
  </parameter>

  <parameter>
  <name>url</name>

<value>jdbc:postgresql://efch-mia-sr-02.efcholdings.com:5432/efch-art</value
>
  </parameter>

  <parameter>
  <name>username</name>
  <value>[username]</value>
  </parameter>

  <parameter>
  <name>password</name>
  <value>[password]</value>
  </parameter>

  <parameter>
  <name>maxActive</name>
  <value>20</value>
  </parameter>

  <parameter>
  <name>maxIdle</name>
  <value>10</value>
  </parameter>

  <parameter>
  <name>maxWait</name>
  <value>100</value>
  </parameter>

  </ResourceParams>

          ----------------------- SERVER.XML end --------------------------

         All that code inside a context tag.

      3.) My web.xml

         ----------------- STARTS ---------------
       <resource-ref>
        <description>postgreSQL Art's Datasource</description>
        <res-ref-name>jdbc/art</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
       --------------------- END -------------------

    5.) I'm using Tomcat 4.1.16 with Apache 2.0, Plus PostgreSQL 7.3 and jdk
1.4.1

    Tomcat starts fine, all works fine but when my DBTest is triying to get
the
connection I get the error mentioned before. I really don't know why tomcat
is
not seeing the Driver if it is on common/lib...???????????

    Thanks in advance for your help.
--
=             Roberto Bouza Fraga               =
===================================
      Research & Development Engineer
       Ella Cisneros Fontanals Holdings
 Ph: (305)-860-0116 / Fax:(305)-860-9401
===================================
       e-Mail:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


        
**********************************************************************  
Ce message électronique et tous les fichiers joints ainsi que  les
informations contenues dans ce message (ci après "le message"), sont
confidentiels et destinés exclusivement à l'usage de la  personne à laquelle
ils sont adressés. Si vous avez reçu ce message par erreur, merci  de le
renvoyer à son émetteur et de le détruire. Toute diffusion, publication,
totale ou partielle ou divulgation sous quelque forme que ce soit non
expressément autorisées de ce message, sont interdites.  
        
**********************************************************************  
This e-mail, any attachments and the information contained (herein " the
message") are confidential and intended solely for the use of the
addressee(s) if you have received this message in error please send it back
to the sender and delete it. Unauthorized publication, use, dissemination or
disclosure, either whole or partial, of this  message is strictly
prohibited.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to