-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Frank,
On 12/16/11 7:49 PM, Frank Zhang wrote: > Our code is using apache dbcp library and mysql-connector as JDBC > driver other than tomcat own tomcat-dbcp.jar. Are you attempting to use the classes in tomcat-dbcp.jar directly? Or, do you just mean that you are using a JNDI DataSource set up in your <Context> element, and so Tomcat is using tomcat-dbcp.jar? > we always put mysql-connector at CATALINA_HOME/lib Good, if you are letting Tomcat configure your DataSource. > while put commons-dbcp-1.4.jar at > CATALINA_HOME/webapps/client/WEB-INF/lib/. Well, if you expect to use commons-dbcp directly, then this is probably what you should do. If you are just using Tomcat's JNDI DataSource, then you don't need this library anywhere at all. > This worked fairly well in tomcat 6.0.2x and even in 6.0.33. In > 6.0.35 I encountered the error "java.sql.SQLException: No suitable > driver found for" during the booting time which looks like > mysql-connector not in classpath. CATALINA_HOME/lib will be in the CLASSPATH for Tomcat's ClassLoader, which will be used after your webapp's ClassLoader, depending on exactly when the driver tries to load. > Considering it's working all right before, my suspect is 6.0.35 > silently changed its class loading way. Could somebody give me > some hints? Thanks. I suspect nothing has changed in Tomcat. > Accidentally, I tried putting mysql-connector to > CATALINA_HOME/webapps/client/WEB-INF/lib/, but no better result. If you are using a JNDI DataSource, you should probably have it in CATALINA_HOME/lib and nowhere else. > [java] java.sql.SQLException: No suitable driver found for > jdbc:mysql://localhost:3306/cloud?autoReconnect=true&prepStmtCacheSize=517&cachePrepStmts=true > > [java] at java.sql.DriverManager.getConnection(DriverManager.java:640) > [java] at > java.sql.DriverManager.getConnection(DriverManager.java:200) [java] > at > org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75) > > [java] at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) > [java] at > org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181) > > [java] at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) > [java] at > com.cloud.utils.db.Transaction.getStandaloneConnectionWithException(Transaction.java:199) So, > that looks like you are NOT using a Tomcat-created JNDI DataSource, but instead using commons-dbcp directly. I don't think you are using tomat-dbcp.jar at all, since those aren't the right class names. Given that, I would expect you to put both the driver *and* commons-dbcp.jar into your webapp's WEB-INF/lib directory. Make sure that neither of those JAR files are also found in CATALINA_HOME/lib. Can you re-confirm your current setup? - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7zt+sACgkQ9CaO5/Lv0PDCHgCeLuGjal4C6YjS+KKdJxCVIahl ZioAnjWFq1Lr9JriKv3IVXtFljnXE3Oy =Qndz -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org