2010-06-04 128 views
2

我想要配置Tomcat中的DB2數據庫的數據源(使用Eclipse作爲IDE),但我不能解決問題,Tomcat的特羅我以下異常:Tomcat的DB2的JDBC數據源配置

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.ibm.db2.jcc.DB2Driver' 
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136) 
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) 
    at com.azurian.lce.usuarios.ConnectionManager.getConnection(ConnectionManager.java:65) 
    at com.azurian.lce.usuarios.db2.UsuarioDAOImpl.autenticar(UsuarioDAOImpl.java:101) 
    at com.azurian.lce.usuarios.UsuarioServiceImpl.autenticar(UsuarioServiceImpl.java:31) 
    at com.azurian.lce.web.admin.actions.LoginAction.execute(LoginAction.java:49) 
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) 
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) 
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClassInternal(Unknown Source) 
    at java.lang.Class.forName0(Native Method) 
    at java.lang.Class.forName(Unknown Source) 
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130) 
    ... 23 more 

這裏我把DB2的JDBC文件?我嘗試在每個地方(在項目的庫中,在tomcat安裝目錄的lib文件夾中,在Dinamic Web Project的WEB-INF/lib文件夾中,在eclipse「tomcat server」配置中的tomcat classpath中到目前爲止)

問候

PS:我使用的是:

DB2 9.7 的Tomcat 6 JDK 1.6 Eclipse的伽利略

回答

4

你需要把它的Eclipse外面的/lib文件夾Tomcat或任何路徑的特殊字符在/conf/catalina.properties cified在shared.loadercommon.loader性質。如果它不能解決問題,那麼它不是您認爲Eclipse正在使用的正確的Tomcat實例。

如果一切順利(丟棄在服務器庫中的JDBC驅動程序),那麼你應該看到它在[項目]/Java的資源(SRC)/庫/ [服務器]在Project Explorer上市露面。

+0

謝謝,你是對的:) – 2010-06-04 19:14:14

相關問題