Exception happened when try to openSqlSession, WHY
ERROR LOG
2017-09-27 21:14:32,409 [pool-13-thread-1] ERROR - test sql error
org.apache.ibatis.exceptions.PersistenceException:
### Error getting a new connection. Cause: java.sql.SQLException: I/O Error: Socket closed
### Cause: java.sql.SQLException: I/O Error: Socket closed
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getConnection(DefaultSqlSession.java:300)
JAVA CODE
sqlSession = sqlSessionFactory.openSession(autoCommit);
DATABASE Config
<dataSource type="POOLED">
<property name="driver" value="${driver}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
<property name="poolPingEnabled" value="true" />
<property name="poolPingQuery" value="SELECT 1" />
<property name="poolPingConnectionsNotUsedFor" value="3600000" />
</dataSource>
A
'I/O Error: Socket closed'exception means that the connection between the JDBC client and the server was closed for some reason.My advice will be use some connection pool library if you are not using any pool.
The reason could be one of the following: