exception:org.springframework.dao.RecoverableDataAccessException:
Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 262,050 milliseconds ago. The last packet sent successfully to the server was 262,053 milliseconds ago.
本次 是因为获取数据库连接的时候获取到无效的连接导致该异常。
解决方式:
设置数据源该属性
<property name="validationQuery" value="SELECT 1"/>
<property name="testOnBorrow" value="true"/>
网友评论