嵌套异常是 org.hibernate.exception.JDBCConnection

我有一个不能在 Windows 上运行的应用程序。但它在 linux(Ubuntu) 上运行良好,代码完全相同。MySQL 抛出异常,我不知道如何解决它。


例外是:


HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection

下面是完整的堆栈跟踪。


May 25, 2019 4:26:40 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions

WARN: SQL Error: 0, SQLState: 08001

May 25, 2019 4:26:40 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions

ERROR: Could not create connection to database server.

May 25, 2019 4:26:40 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [SpringDispatcher] in context with path [/SpringMVCAnnotationShoppingCart] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection] with root cause

java.lang.NullPointerException

    at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:2983)

    at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1873)

    at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1802)

    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206)

    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2234)

    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)

    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)

    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)

    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)


POPMUISE
浏览 130回答 1
1回答

红糖糍粑

确保端口:3306 上没有其他应用程序在运行。并且还为用于运行 java 的服务器配置不同的端口。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java