报错:SQLException: Cannot load JDBC driver class 'com.ibm.db2.jcc.DB2Driver'

liu奇峰 发布于 2012/07/30 13:42
阅读 6K+
收藏 0
DB2

在D:\apache-tomcat-5.5.26\conf\Catalina\localhost下新建了sgcms.xml文件 配了如下的连接池

<?xml version="1.0" encoding="UTF-8"?>

<Context path="/sgcms" debug="0" docBase="D:\Projects\sgcms\WebRoot"

reloadable="true" crossContext="true"

antiResourceLocking="false"   antiJARLocking="false" >

<Environment name="tyrexDomainConfig" type="java.lang.String" value="domain-config.xml"/>

     <Environment name="tyrexDomainName" type="java.lang.String" value="emDomain"/>  

     <Resource name="jdbc/emdb" auth="Container" type="javax.sql.DataSource" maxActive="8" maxIdle="30" maxWait="10000"

               username="sgcms" password="sgcms" driverClassName="com.ibm.db2.jcc.DB2Driver"

               url="jdbc:db2://10.20.12.225:50000/sgcms"/>

</Context>

工程可以起来了,登陆页面也可以出来了。但是已输入用户名、密码就报错,是缺少db2的jccjar包吗?百度知道来的不知道对不对,谁能给解释下啊 谢谢。

ERROR [jsp] Servlet.service() for servlet jsp threw exception

com.astar.cop.util.exception.COPModuleException: Chained Exception: com.astar.cop.util.exception.COPDAOException: Chained Exception: java.sql.SQLException: Cannot load JDBC driver class 'com.ibm.db2.jcc.DB2Driver'

at com.neusoft.ermsuite.common.sm.privilege.user.module.UserModule.CheckUser(UserModule.java:372)

at com.neusoft.ermsuite.common.sm.login.LoginHandleImpl.loginHandle(LoginHandleImpl.java:95)

at org.apache.jsp.loginHandle_jsp._jspService(loginHandle_jsp.java:94)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

at com.neusoft.ermsuite.mpc.util.filter.encode.EncodingFilter.doFilter(EncodingFilter.java:48)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)

at java.lang.Thread.run(Thread.java:595)

加载中
0
sxgkwei
sxgkwei
太常见了吧。找不到驱动jar。。。如果要加jar包,记住jar包和数据库不仅要一致,而且版本也要对应起来。
0
樂
个人感觉少jar包或者jar包版本不对
0
liu奇峰
liu奇峰
嗯 是的,已经解决了,之前连的都是oracle,今天换成了db2,所以tomcat中缺少jar包,后来将工程文件下webinfo ->lib下的jccdb2这几个jar包加到tomcat下就可以了。谢谢各位大虾了!
返回顶部
顶部