tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Munson <ebmun...@gmail.com>
Subject Cannot create JDBC driver of class '' for connect URL 'null' Exception Help
Date Mon, 02 Jan 2006 05:40:43 GMT
I am using Tomcat 5.5.9, MySQL 4.1.14, Java 5.0 Update 5, MySQL-JDBC
Connector version 3.1.11, commons-collections-3.1.jar,
commons-pool-1.2.jar, commons-dbcp-1.2.1.jar, running on Debian
Stable.  I have been fighting with this for several days now and I am
no closer to a solution, can
someone please point out what I am doing incorrectly.  Here is the exception:

Jan 1, 2006 1:26:45 PM org.eandk.data.User load
SEVERE: [User.load]: Load query failed with SQLException: Cannot
create JDBC driver of class '' for connect URL 'null'
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:540)
       at org.eandk.data.User.load(Unknown Source)
       at org.eandk.pages.admin.SecureHandler.handleRequest(Unknown Source)
       at org.eandk.AdminSite.doPost(Unknown Source)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: No suitable driver
       at java.sql.DriverManager.getDriver(DriverManager.java:243)
       at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
       ... 20 more

Here is my server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Server>
 <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
 <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
 <GlobalNamingResources>
   <Environment
     name="simpleValue"
     type="java.lang.Integer"
     value="30"/>
   <Resource
     auth="Container"
     description="User database that can be updated and saved"
     name="UserDatabase"
     type="org.apache.catalina.UserDatabase"
     pathname="conf/tomcat-users.xml"
     factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
   <Resource
     auth="Container"
     name="jdbc/presserfoot"
     type="javax.sql.DataSource"
     password="PASSWORD"
     driverClassName="com.mysql.jdbc.Driver"
     maxIdle="2"
     maxWait="5000"
     username="javadb"
url="jdbc:mysql://localhost:3306/presserfoot?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=U
TF8&amp;amp;max-connections=50&amp;amp;min-connections=2&amp;amp;inactivity-timeout=30&amp;amp;wait-timeout=30"
     maxActive="4"/>
 </GlobalNamingResources>
 <Service
     name="Catalina">
   <Connector
       port="80"
       minSpareThreads="25"
       connectionTimeout="20000"
       maxSpareThreads="75"
       maxThreads="150"
       maxHttpHeaderSize="8192"
       compression="on">
   </Connector>
   <Connector
       URIEncoding="null"
       port="443"
       scheme="https"
       secure="true"
       minSpareThreads="25"
       clientAuth="false"
       uRIEncoding="null"
       maxSpareThreads="75"
       maxThreads="150"
       maxHttpHeaderSize="8192"
       compression="on">
   </Connector>
   <Connector
       port="8009"
       redirectPort="8443"
       protocol="AJP/1.3">
   </Connector>
   <Engine
       defaultHost="localhost"
       name="Catalina">
     <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
     <Host
         appBase="webapps"
         name="localhost">
       <Context
           path="/sample">
         <WatchedResource>WEB-INF/web.xml</WatchedResource>
       </Context>
     </Host>
   </Engine>
 </Service>
</Server>

I have a context.xml in $CATALINA_HOME/webapps/pfadmin/META-INF, its
contents are:
<Context path="/pfadmin" docBase="pfadmin" debug="5" reloadable="true">
 <Logger className="org.apache.catalina.logger.FileLogger"
            prefix="localhost_DBpresserfoot_log." suffix=".txt"
            timestamp="true"/>
 <ResourceLink global="jdbc/presserfoot" name="jdbc/presserfoot"
type="javax.sql.DataSource"/>
</Context>

I know the servlet is working because I get a static response from it
before a database query is made.  Here is the method that is the code
snippet around the query:
...
        Context ctx = new InitialContext( );
        DataSource ds = (DataSource)ctx.lookup(
"java:comp/env/jdbc/presserfoot" );
        conn = ds.getConnection();
        stmt = conn.createStatement( );
        String query = "SELECT id,passwd FROM user WHERE uname LIKE " + uName +
           ";";
        rs = stmt.executeQuery( query );
...

Can someone please point out the error I am making, I would appreciate
any help that can be given.  Thanks.

Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message