org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

二次信任 提交于 2019-12-04 07:11:29

I just got through a similar error and it turns out my context.xml file was slightly mangled. I think this most likely is where the problem resides.

My suggestion in comparing context.xml files between myself and you, I say try this

driverClass

In place of

driverClassName

I've solved this problem changing the import reference (in my case) from:

import org.apache.tomcat.dbcp.dbcp.BasicDataSource;

to

import org.apache.commons.dbcp.BasicDataSource;

My error was generated because I always use CRTL+o for import references, and when I made the import I had not the .jar in my references. I hope this may be useful for others.

You could also encounter this error if your Tomcat version is different ..then ur context.xml would have to look different ...for detail go to this page ..a must read for this problem :

http://www.crazysquirrel.com/computing/java/connection-pooling.jspx

regs Karthic

In my case helped following changes: in APPLICATION_PATH/WebContent/META_INF/context.xml

old code:

<resource name="jdbc/internships_db" auth="Container" type="javax.sql.DataSource">
    <param name="username" value="my_user" />
    <param name="password" value="my_password" />
    <param name="url" value="jdbc:mysql://localhost:3306/internships_db" />
</resource>

new code:

<Resource name="jdbc/internships_db"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    username="my_user"
    maxWait="10000"
    driverClassName="com.mysql.jdbc.Driver"
    password="my_password"  
    url="jdbc:mysql://localhost:3306/internships_db"/>

Jdbc-Driver class is placed under the path /user_path/tomcat-instance_path/webapps/app_name/WEB-INF/lib/com.mysql.jdbc_5.1.5.jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!