首页 > 代码库 > SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 解决办法

SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 解决办法

当跑jndi项目时抛出:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ‘‘ for connect URL ‘null‘异常

解决办法:

1、在Tomcat 6.0\lib下加入oracle驱动包ojdbc14_g-10.2.0.1.0.jar

2、在Tomcat 6.0\conf下的context.xml文件中加入

[javascript] view plaincopy
 
  1. <Resource  
  2.       name="jdbc/aaa_db"  
  3.       type="javax.sql.DataSource"  
  4.       username="test"  
  5.       password="123456"  
  6.       driverClassName="oracle.jdbc.driver.OracleDriver"  
  7.       maxIdle="3"  
  8.       maxWait="5000"  
  9.       url="jdbc:oracle:thin:@192.168.30.99:1521:orcl"  
  10.       maxActive="10"/>  

3、检查项目中web.xml里面的配置是否和context.xml实例名一样

 

[javascript] view plaincopy
 
  1. <resource-ref>  
  2.    <description>db connect</description>  
  3.    <res-ref-name>jdbc/aaa_db</res-ref-name>  
  4.    <res-type>javax.sql.DataSource</res-type>  
  5.    <res-auth>Container</res-auth>  
  6. </resource-ref>  

SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 解决办法