tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roberts, Eric" <Eric.Robe...@one.at>
Subject RE: java.sql.SQLException: Cannot load JDBC driver class 'null'
Date Thu, 05 Dec 2002 08:45:27 GMT
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:rbouza@efcholdings.com]
Sent: Mittwoch, 04. Dezember 2002 23:05
To: tomcat-user@jakarta.apache.org
Cc: rbouza@efcholdings.com
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:rbouza@efcholdings.com

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message