配置Struts连接池时遇到的一个问题

来源:互联网 发布:米格23 知乎 编辑:程序博客网 时间:2024/06/03 14:56
我在配置连接池的时候(用的是commons-dbcp-1.2.1),把MySQL的JDBC驱动包放在WEB-INF/lib目录下
Tomcat启动时报错,说是ClassNotFound “org.gjt.mm.mysql.Driver”
后来在tomcat-docs发现下面一段:

DBCP uses the Jakarta-Commons Database Connection Pool. It relies on number of Jakarta-Commons componenets:

  • Jakarta-Commons DBCP 1.0
  • Jakarta-Commons Collections 2.0
  • Jakarta-Commons Pool 1.0
These jar files along with your the jar file for your JDBC driver should be installed in $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.
发现学习Java在这些配置问题的细节上要纠缠好多时间,希望将来能变好些吧。
原创粉丝点击