当前位置: 代码迷 >> J2EE >> Tomcat报错有关问题
  详细解决方案

Tomcat报错有关问题

热度:81   发布时间:2016-04-22 01:51:33.0
Tomcat报错问题
我的strusts-config.xml 里面的配置是这样的

XML code
<data-sources>        <data-source key="bbsDB" type="org.apache.commons.dbcp.BasicDataSource">            <set-property property="driverClassName" value="org.gjt.mm.mysql.Driver" />            <set-property property="url" value="jdbc:mysql://localhost:3306/bbs?useUnicode=true&amp;characterEncoding=UTF-8" />            <set-property property="username" value="root" />            <set-property property="password" value="liang" />        </data-source>    </data-sources>


Tomcat启动时报了三个错误

严重: Initializing application data source bbsDB
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:959)
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:808)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1228)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1147)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
... 15 more
2012-3-31 8:48:50 org.apache.catalina.core.ApplicationContext log
信息: Marking servlet action as unavailable
2012-3-31 8:48:50 org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet /BBS threw load() exception
javax.servlet.UnavailableException: Initializing application data source bbsDB
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:812)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1228)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1147)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
  相关解决方案