环境:tomcat6、jdk1.6、oracle10g、myeclipse8.6
当跑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文件中加入
<Resource name="jdbc/aaa_db" type="javax.sql.DataSource" username="test" password="123456" driverClassName="oracle.jdbc.driver.OracleDriver" maxIdle="3" maxWait="5000" url="jdbc:oracle:thin:@192.168.30.99:1521:orcl" maxActive="10"/>
3、检查项目中web.xml里面的配置是否和context.xml实例名一样
<resource-ref> <description>db connect</description> <res-ref-name>jdbc/aaa_db</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>