我在配置连接池的时候(用的是commons-dbcp-1.2.1),把MySQL的JDBC驱动包放在WEB-INF/lib目录下
Tomcat启动时报错,说是ClassNotFound “org.gjt.mm.mysql.Driver”
后来在tomcat-docs发现下面一段:
Tomcat启动时报错,说是ClassNotFound “org.gjt.mm.mysql.Driver”
后来在tomcat-docs发现下面一段:
发现学习Java在这些配置问题的细节上要纠缠好多时间,希望将来能变好些吧。DBCP uses the Jakarta-Commons Database Connection Pool. It relies on number of Jakarta-Commons componenets:
These jar files along with your the jar file for your JDBC driver should be installed in
- Jakarta-Commons DBCP 1.0
- Jakarta-Commons Collections 2.0
- Jakarta-Commons Pool 1.0
$CATALINA_HOME/common/lib
.NOTE:Third Party drivers should be in jarfiles, not zipfiles. Tomcat only adds$CATALINA_HOME/common/lib/*.jar
to the classpath.NOTE: Do not install these jarfiles in your/WEB-INF/lib
, or$JAVA_HOME/jre/lib/ext
, or anywhere else. You will experience problems if you install them anyplace other than$CATALINA_HOME/common/lib
.