tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ed Sykes" <esykes...@cogeco.ca>
Subject Cannot create JDBC driver of class '' for connect URL 'null'
Date Mon, 15 Nov 2004 16:48:55 GMT
Hi,

 

I'm trying to setup DBCP with Tomcat 5.5.4 with Oracle 8.1.6 using Java 1.5.0

 

I've read FAQ, and the Jakarta How-To Docs:  

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html

 

Everything works fine if I don't use connection pooling or JNDI lookups.

i.e., 

 

Class.forName(Connection_Info.JDBC_DRIVER);

conn = DriverManager.getConnection(URL, USERNAME, PASSWORD);

stmt = conn.createStatement();

 

works fine.  So, Tomcat finds the Oracle JDBC driver fine.

 

I'm getting the following error:

 

Cannot create JDBC driver of class '' for connect URL 'null'

 

Here's is the section I've added to C:\jakarta-tomcat-5.5.4\conf\server.xml

 

<Context path="/ROOT/WEB-INF/classes" docBase="ROOT/WEB-INF/classes/JITS"

        debug="5" reloadable="true" crossContext="true">

  

   <Resource name="jdbc/myoracle" auth="Container"

              type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"

              url="jdbc:oracle:thin:@newton.sheridanc.on.ca:1522:DB2"

              username="jits" password="mypassword" maxActive="20" maxIdle="10"

              maxWait="-1"/> 

 

<ResourceParams name="jdbc/myoracle">

  <parameter>

    <name>factory</name>

    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>

  </parameter>

  <parameter>

    <name>driverClassName</name>

    <value>oracle.jdbc.driver.OracleDriver</value>

  </parameter>

  <parameter>

    <name>url</name>

    <value>jdbc:oracle:thin:@newton.sheridanc.on.ca:1522:DB2</value>

  </parameter>

  <parameter>

    <name>username</name>

    <value>jits</value>

  </parameter>

  <parameter>

    <name>password</name>

    <value>mypassword</value>

  </parameter>

  <parameter>

    <name>maxActive</name>

    <value>20</value>

  </parameter>

  <parameter>

    <name>maxIdle</name>

    <value>10</value>

  </parameter>

  <parameter>

    <name>maxWait</name>

    <value>-1</value>

  </parameter>

</ResourceParams>

 

 

    </Context>

 

 

 

 

Here's the contents of C:\jakarta-tomcat-5.5.4\webapps\ROOT\WEB-INF\web.xml

 

 

    <servlet>

        <servlet-name>JITS.ImageServer</servlet-name>

        <servlet-class>JITS.ImageServer</servlet-class>

    </servlet>

 

  <servlet-mapping>

        <servlet-name>JITS.ImageServer</servlet-name>

        <url-pattern>/servlet/JITS.ImageServer</url-pattern>

    </servlet-mapping>

 

 <resource-ref>

 <description>Oracle Datasource example</description>

 <res-ref-name>jdbc/myoracle</res-ref-name>

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

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

</resource-ref>

 

 

 

In my java file ( ImageServer.java )  :

 

 

        Context initContext = new InitialContext();

        System.out.println("1 got an initial context from JNDI");

        

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

        System.out.println("2 got a context from JNDI");

        

        DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");

        System.out.println("3 got a datasource from JNDI");

        

        

        Connection conn = ds.getConnection();       

        System.out.println("4 got a connection from the pool");

       

 

 

OUTPUT:

1 got an initial context from JNDI

2 got a context from JNDI

3 got a datasource from JNDI

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for
connect URL 'null'

        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)

        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:554)

        at JITS.ImageServer.getImage(ImageServer.java:48)

 

 

Any suggestions would be gratefully appreciated !

 

Sincerely,

Ed Sykes

 

 

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