当前位置: 代码迷 >> Java Web开发 >> tomcat4.1配置数据源的有关问题
  详细解决方案

tomcat4.1配置数据源的有关问题

热度:9006   发布时间:2013-02-25 21:09:46
tomcat4.1配置数据源的问题
最近维护一个项目,想在Eclipse中运行起来,配置数据源的时候出错:

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: 
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
at com.visionsky.util.Util.getConnection(Util.java:77)
at com.visionsky.util.CodeBase.init(CodeBase.java:322)
at com.visionsky.controls.Main.init(Main.java:265)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:935)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3422)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3623)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:307)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
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:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
其中,我在web.xml中是这样写的:
  <resource-ref id="ResourceRef_1115288292265">
  <res-ref-name>jdbc/CCASDataSource</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
  <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
在tomcat的I:\Tomcat4.1\conf\server.xml中这样写的:
  <Resource name="jdbc/CCASDataSource" auth="Container" scope="Shareable" type="javax.sql.DataSource"/>
  <ResourceParams name="UserDatabase">
  <parameter>
  <name>factory</name>
  <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
  </parameter>
  <parameter>
  <name>pathname</name>
  <value>conf/tomcat-users.xml</value>
  </parameter>
  </ResourceParams>
  <ResourceParams name="jdbc/CCASDataSource">