Communications link failure due to underlying exception:

21:00:34,207  WARN SettingsFactory:117 - Could not obtain connection metadata
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

com.mysql.jdbc.CommunicationsException
MESSAGE: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException

 

今天遇到了两次这个异常,查了很久,原来是在hibernate配置文件中的url 的端口设置错误,MySQL默认为3306.

<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate_page?characterEncoding=gbk</property>

你可能感兴趣的:(java,mysql,Hibernate,jdbc)