SQLException堆栈跟踪

时间:2015-10-12 12:36:31

标签: java mysql spring tomcat

所以我有点奇怪的情况。我有Spring webapp,在其中我有我在tomcat的server.xml中定义的JNDI数据源连接到mysql数据库 我的Maven pom中有mysql-connector-java 5.1.2。

当我从localhost启动应用程序时,应用程序正常工作,但是当我将它部署到远程tomcat时,它没有得到对数据库的调用。

发生此异常:

Couldnt execute sql CALL shareholders_company_list(?)
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unable to create correct SQLException class instance, error class/codes may be incorrect. Reason:

** BEGIN NESTED EXCEPTION **

java.sql.SQLException
MESSAGE: Can't instantiate required class due to java.lang.ClassNotFoundException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException

STACKTRACE:

java.sql.SQLException: Can't instantiate required class due to java.lang.ClassNotFoundException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException

是否存在避免此ClassNotFoundException,以便我可以获得完整的堆栈跟踪,因为看起来显式错误导致这种情况发生在MySQLNonTransientConnectionException中,我似乎无法达到它。

1 个答案:

答案 0 :(得分:2)

mysql-connector-java-latestVersion.jar

下的tomcat\lib导入所需版本(如果您没有最新的偏好)