tomcat7: Could not load JDBC driver class [com.mysql.jdbc.Driver]

前端 未结 2 1232
说谎
说谎 2021-01-04 07:23

I\'ve seen several similar questions on stackoverflow, but they didn\'t solved my problem. This one is specially useful, since it points to official tomcat documentation an

2条回答
  •  伪装坚强ぢ
    2021-01-04 08:20

    The solutions provided there is, in short: tomcat needs jdbc database drivers to be copied to $CATALINA_HOME/lib/, because it will not find them under WEB-INF/lib/. Ok, but it still does not work for me, and I am becoming mad.

    This depends on how you load the driver.

    If you configure the driver within you tomcat and provide it to the application then this statement is correct.

    But you load the driver directly within your application. Then both ways, $CATALINA_HOME/lib/ (in tomcat) as well as WEB-INF/lib/ (in application) should work.

    But Spring use a special way to load that class Class.forName(driverClassNameToUse, true, ClassUtils.getDefaultClassLoader()) and I dont know how it behave for files in $CATALINA_HOME/lib/ so I would try to put the files in your application WEB-INF/lib/ folder

提交回复
热议问题