Hi,

I have a ServletContextListener which loads application resources from an Oracle 
database when application is installed. But a SQLException(see below) is thorwn becase 
DBCP cannot load JDBC driver. The JDBC driver(ojdbc14.jar) is installed in the 
${CATALINA_HOME}/common/lib according to the instructions in the JNDI resources 
tutorial. I use 'ant install' task and DBCP connection pooling (commons-dbcp.jar are 
in ${CATALINA_HOME}/common/lib and WEB-INF/lib, but I d'ont think this is the 
problem). All work well until I want to load the resouces in the 
ServletContextListener(If I d'ont use the ServletContextListener, all work well). I 
use the follwoing environment:

Win2000 professional with SP3,
j2sdk-1.4.1_01
tomcat 4.1.8
Oracle 9i
JDBC driver : ojdbc14.jar (I have tried classes12.jar with jdk1.3.1, the problem also 
occurs).

Config in the server.xml:
  <DefaultContext>
  <Resource name="jdbc/ClassifiedDb" auth="Container"
                    type="javax.sql.DataSource"/>
           <ResourceParams name="jdbc/ClassifiedDb">
  <parameter>
   <name>username</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>url</name>
   <value>jdbc:oracle:thin:@localhost:1521:ora</value>
  </parameter>
  </ResourceParams>
   </DefaultContext>

The config in the web.xml
<resource-ref>
  <description>
    Resource reference to a factory for java.sql.Connection
    instances that may be used for talking to a particular
    database that is configured in the server.xml file.
  </description>
  <res-ref-name>
  jdbc/ClassifiedDb
  </res-ref-name>
  <res-type>
    javax.sql.DataSource
  </res-type>
  <res-auth>
    Container
  </res-auth>
</resource-ref>


java.sql.SQLException: Cannot load JDBC driver class 'null'
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:529)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:312)
        at com.chinatown.classified.dao.AbstractDAO.getConnection(AbstractDAO.ja
va:51)
        at com.chinatown.classified.dao.CategoryDAO.findAllProvence(CategoryDAO.
java:46)
        at com.chinatown.classified.context.CategoryContextListener.contextIniti
alized(CategoryContextListener.java:73)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3269)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
598)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:821)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)

        at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
loyer.java:257)
        at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
        at org.apache.catalina.servlets.ManagerServlet.install(ManagerServlet.ja
va:650)
        at org.apache.catalina.servlets.ManagerServlet.doGet(ManagerServlet.java
:342)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

Any help will be apprecied.

Peiqiang Han

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

Reply via email to