You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andreas Schildbach <an...@schildbach.de> on 2004/02/11 18:10:25 UTC

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: java.sql.SQLException: No suitable driver

I get this error using Tomcat 5.0.18 under Debian/Linux. Using the same 
configuration under Windows XP, there is no problem. Using the same 
application under Tomcat 4.1.27, there is no problem (either Linux or 
Windows).

As you can see from the included stack trace, I am using Hibernate which 
is accessing the configured DataSource in a Servlet Filter at 
application startup.

I have searched for this problem on this Mailing List, but got no clue. 
I am using a Context local DataSource (no Global), and have everything 
strictly setup as described in the JNDI HowTo. Given the number of 
people that could not solve the problem, maybe there is a bug in Tomcat5?

Regards,

Andreas

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of 
class '' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getDriver(DriverManager.java:243)
         at 
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
         at 
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
         at 
net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
         at 
net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
         at 
net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1119)
         at 
net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:748)
         at 
de.schildbach.integration.HibernatePersistance.init(HibernatePersistance.java:41)
         at 
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:272)
         at 
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:355)
         at 
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:126)
         at 
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3646)
         at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4275)
         at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
         at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)
         at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:638)
         at 
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:320)
         at 
org.apache.catalina.core.StandardHost.install(StandardHost.java:875)
         at 
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:727)
         at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:477)
         at 
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1008)
         at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:394)
         at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
         at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
         at 
org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
         at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
         at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
         at 
org.apache.catalina.core.StandardService.start(StandardService.java:519)
         at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:2345)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:598)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)

My server.xml:

                                 <Context path="" docBase="schildbach" 
reloadable="false">

                                         <Resource name="jdbc/xxx" 
auth="Container" type="javax.sql.DataSource"/>
                                         <ResourceParams 
name="jdbc/schildbach">
 
<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
 
<parameter><name>maxActive</name><value>5</value></parameter>
 
<parameter><name>maxIdle</name><value>0</value></parameter>
 
<parameter><name>maxWait</name><value>10000</value></parameter>
 
<parameter><name>username</name><value>xxx</value></parameter>
 
<parameter><name>password</name><value>xxx</value></parameter>
 
<parameter><name>driverClassName</name><value>com.mysql.jdbc.Driver</value></parameter>
 
<parameter><name>url</name><value>jdbc:mysql://localhost/xxx?autoReconnect=true&amp;relaxAutoCommit=true</value></parameter>
                                         </ResourceParams>

                                 </Context>

My web.xml:

         <resource-ref>
                 <res-ref-name>jdbc/xxx</res-ref-name>
                 <res-type>javax.sql.DataSource</res-type>
                 <res-auth>Container</res-auth>
         </resource-ref>


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


Re: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: java.sql.SQLException: No suitable driver

Posted by Andreas Schildbach <an...@schildbach.de>.
daniel@etrak-plus.com wrote:

> where did u put the jar?
> thats what got me.
> it needs to go in common\lib in your tomcat dir

Here is the content of common/lib

xxx:/opt/tomcat5# ls -la common/lib
total 3376
drwxr-xr-x    2 tomcat5  nogroup      4096 Feb 11 17:07 .
drwxr-xr-x    5 tomcat5  nogroup      4096 Jan 15 18:24 ..
-rw-r--r--    1 tomcat5  nogroup     54665 Feb 11 10:24 activation.jar
-rw-r--r--    1 tomcat5  nogroup    952104 Jan 15 18:24 ant.jar
-rw-r--r--    1 tomcat5  nogroup    165119 Jan 15 18:24 
commons-collections.jar
-rw-r--r--    1 tomcat5  nogroup    100776 Jan 15 18:24 commons-dbcp-1.1.jar
-rw-r--r--    1 tomcat5  nogroup    112341 Jan 15 18:24 commons-el.jar
-rw-r--r--    1 tomcat5  nogroup     39523 Jan 15 18:24 commons-pool-1.1.jar
-rw-r--r--    1 tomcat5  nogroup    342455 Jan 15 18:24 jasper-compiler.jar
-rw-r--r--    1 tomcat5  nogroup    100925 Jan 15 18:24 jasper-runtime.jar
-rw-r--r--    1 tomcat5  nogroup    188231 Jan 15 18:24 jmx-remote-tools.jar
-rw-r--r--    1 tomcat5  nogroup    168008 Jan 15 18:24 jmx-remote.jar
-rw-r--r--    1 tomcat5  nogroup    365858 Jan 15 18:24 jmx.jar
-rw-r--r--    1 tomcat5  nogroup     48725 Jan 15 18:24 jsp-api.jar
-rw-r--r--    1 tomcat5  nogroup    327603 Feb 11 10:24 mail.jar
-rw-r--r--    1 tomcat5  nogroup    215441 Feb 11 17:07 
mysql-connector-java-3.0.10-stable-bin.jar
-rw-r--r--    1 tomcat5  nogroup     28015 Jan 15 18:24 naming-common.jar
-rw-r--r--    1 tomcat5  nogroup     14862 Jan 15 18:24 naming-factory.jar
-rw-r--r--    1 tomcat5  nogroup      2068 Jan 15 18:24 naming-java.jar
-rw-r--r--    1 tomcat5  nogroup     41669 Jan 15 18:24 naming-resources.jar
-rw-r--r--    1 tomcat5  nogroup     91627 Jan 15 18:24 servlet-api.jar


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


Re: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: java.sql.SQLException: No suitable driver

Posted by da...@etrak-plus.com.
where did u put the jar?
thats what got me.
it needs to go in common\lib in your tomcat dir

Daniel Schulken
----- Original Message ----- 
From: "Andreas Schildbach" <an...@schildbach.de>
To: <to...@jakarta.apache.org>
Sent: Wednesday, February 11, 2004 2:51 PM
Subject: Re: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null', cause: java.sql.SQLException: No
suitable driver


> Andreas Schildbach wrote:
>
> > I get this error using Tomcat 5.0.18 under Debian/Linux. Using the same
> > configuration under Windows XP, there is no problem. Using the same
> > application under Tomcat 4.1.27, there is no problem (either Linux or
> > Windows).
>
> >                                         <Resource name="jdbc/xxx"
> > auth="Container" type="javax.sql.DataSource"/>
> >                                         <ResourceParams
> > name="jdbc/schildbach">
>               ^^^^^^^^^^
>
> of course, this is also jdbc/xxx (changed it for the post)
>
> Regards,
>
> Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004


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


Re: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: java.sql.SQLException: No suitable driver

Posted by Andreas Schildbach <an...@schildbach.de>.
Andreas Schildbach wrote:

> I get this error using Tomcat 5.0.18 under Debian/Linux. Using the same 
> configuration under Windows XP, there is no problem. Using the same 
> application under Tomcat 4.1.27, there is no problem (either Linux or 
> Windows).

>                                         <Resource name="jdbc/xxx" 
> auth="Container" type="javax.sql.DataSource"/>
>                                         <ResourceParams 
> name="jdbc/schildbach">
              ^^^^^^^^^^

of course, this is also jdbc/xxx (changed it for the post)

Regards,

Andreas


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