代码改变世界

org.apache.tomcat.dbcp.dbcp.SQLNestedException

2010-08-23 14:38  CaiGen008  阅读(4992)  评论(2编辑  收藏  举报

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ” for connect URL ‘null’
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at com.bowstreet.builders.webapp.methods.SqlDataSourceHelper$DataSourceHandler.acquireConnection(SqlDataSourceHelper.java:241)
at com.bowstreet.builders.webapp.methods.SqlDataSourceHelper.acquireConnection(SqlDataSourceHelper.java:734)
at com.bowstreet.builders.webapp.methods.SqlDataSourceHelper.acquireConnection(SqlDataSourceHelper.java:697)
at com.bowstreet.builders.webapp.methods.SqlTransformToXmlHelper.executeForCaching(SqlTransformToXmlHelper.java:204)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bowstreet.webapp.engine.actions.MethodAction.callAction(MethodAction.java:90)
at com.bowstreet.webapp.engine.WebAppAccessImpl.callMethod(WebAppAccessImpl.java:405)
at com.bowstreet.webapp.engine.WebAppAccessImpl.callMethod(WebAppAccessImpl.java:286)
at com.bowstreet.builders.webapp.methods.SqlTransformToXmlHelper.execute(SqlTransformToXmlHelper.java:139)
at genjava.dept.user._UserList.getUserListInvokeBase(_UserList.java:218)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bowstreet.webapp.engine.actions.MethodAction.callAction(MethodAction.java:90)
at com.bowstreet.webapp.engine.WebAppAccessImpl.callMethod(WebAppAccessImpl.java:405)
at com.bowstreet.webapp.engine.WebAppAccessImpl.callMethod(WebAppAccessImpl.java:286)
at genjava.dept.user._UserList.getUserListInvoke(_UserList.java:236)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bowstreet.webapp.engine.actions.MethodAction.callAction(MethodAction.java:90)
at com.bowstreet.webapp.engine.WebAppAccessImpl.callMethod(WebAppAccessImpl.java:405)
at genjava.dept.user._UserList.list_page_ShowResults(_UserList.java:357)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bowstreet.webapp.engine.actions.MethodAction.callAction(MethodAction.java:90)
at com.bowstreet.webapp.engine.WebAppAccessImpl.callMethod(WebAppAccessImpl.java:405)
at com.bowstreet.webapp.engine.WebAppAccessImpl.processAction(WebAppAccessImpl.java:1063)
at com.bowstreet.webapp.engine.WebAppAccessImpl.processAction(WebAppAccessImpl.java:1163)
at genjava.dept.user._UserList.main(_UserList.java:344)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bowstreet.webapp.engine.actions.MethodAction.callAction(MethodAction.java:90)
at com.bowstreet.webapp.engine.WebAppAccessImpl.callMethod(WebAppAccessImpl.java:405)
at com.bowstreet.webapp.engine.WebAppAccessImpl.processAction(WebAppAccessImpl.java:1063)
at com.bowstreet.webapp.engine.WebAppAccessImpl.processAction(WebAppAccessImpl.java:1163)
at com.bowstreet.webapp.engine.WebAppRequestRunner.doRequest(WebAppRequestRunner.java:364)
at com.bowstreet.webapp.engine.WebAppRunner.doActualRequest(WebAppRunner.java:923)
at com.bowstreet.webapp.engine.WebAppRunner.doRequest(WebAppRunner.java:535)
at com.bowstreet.webapp.engine.WebAppRunner.doRequest(WebAppRunner.java:300)
at com.bowstreet.webapp.engine.WebAppRunner.doRequest(WebAppRunner.java:237)
at com.bowstreet.webapp.engine.WebAppServlet.doPost(WebAppServlet.java:73)
at com.bowstreet.webapp.engine.WebAppServlet.doGet(WebAppServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
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:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
at java.sql.DriverManager.getDriver(DriverManager.java:253)

在tomcat的server.xml里配置jndi时运行时出现了这个错误,
<Resource name="jdbc/cbb_connection" auth="Container"
   type="javax.sql.DataSource"
   driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
   url="jdbc:sqlserver://localhost:1433;DatabaseName=XXXXX"
   username="XX"
   password="XXXXXX"
   maxActive="100"
   maxIdle= "2"
   maxWait="1000"
   poolPreparedStatements="true"
   defaultAutoCommit="true" />

最后解决方案是将上面的配置放到tomcat 的context.xml里配置,而不要放到server.xml里配置。另外驱动是放置到tomcat lib下的。