tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anastasios Angelidis <voo...@videotron.ca>
Subject java.sql.SQLException: Cannot load JDBC driver class 'null'
Date Thu, 02 Jan 2003 03:29:48 GMT
Hi I downloaded the MySQL Connector/J 2.0.14 JDBC drivers and I copied 
the mysql-connector-java-2.0.14-bin.jar to the common/lib folder...

Here is my server.xml <context> config...

<Context path="/infected" docBase="infected" debug="5" reloadable="true" 
crossContext="true">
    <Logger className="org.apache.catalina.logger.FileLogger" 
prefix="localhost_infected_log." suffix=".txt" timestamp="true"/>
    <Resource name="jdbc/InfectedDB" auth="Container" 
type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/TestDB">
        
<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
        <parameter><name>maxActive</name><value>100</value></parameter>
        <parameter><name>maxIdle</name><value>30</value></parameter>
        <parameter><name>maxWait</name><value>10000</value></parameter>
        <parameter><name>username</name><value>xxxxxx</value></parameter>
        <parameter><name>password</name><value>xxxxxx</value></parameter>
        
<parameter><name>driverClassName</name><value>com.mysql.jdbc.Driver</value></parameter>
        
<parameter><name>url</name><value>jdbc:mysql://localhost:3306/infected</value></parameter>
    </ResourceParams>
</Context>

Here is my web.xml...

<web-app>
    <display-name>infected rhythms</display-name>
      <description>infected rhythms web site</description>
      <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/InfectedDB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
</web-app>


Then I worte this simple JSP code...

try
{
    Context ctx = new InitialContext();

    DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/InfectedDB");

    Connection conn = ds.getConnection();

    The rest of the code...
}
catch(Exception ex)
{
    ex.printStackTrace();
}

The exception os caught whne trying to get the connection Connection 
conn = ds.getConnection(); Any ideas? Thanks
The stack trace...

java.sql.SQLException: Cannot load JDBC driver class 'null'
        at 
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
        at 
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
        at org.apache.jsp.artists_jsp._jspService(artists_jsp.java:57)
        at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

        at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

        at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1040)
        at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151)
        at java.lang.Thread.run(Thread.java:536)


--
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