关于 spring ibatis多数据源问题

樱花泪 发布于 2016/01/25 10:31
阅读 491
收藏 0

配置在这里就不多说了,基本在网上搜得一样,

项目启动后一旦访问数据库后,没几分钟就报异常,如下

Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   

--- The error occurred while applying a parameter map.  

--- Check the AUTHDEPARTMENT.SELECT_PAGE_LIST-InlineParameterMap.  

--- Check the statement (query failed).  

--- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure


The last packet successfully received from the server was 445,587 milliseconds ago.  The last packet sent successfully to the server was 18,300 milliseconds ago.

at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:298) ~[spring-orm-3.2.8.RELEASE.jar:3.2.8.RELEASE]

at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:296) ~[spring-orm-3.2.8.RELEASE.jar:3.2.8.RELEASE]

at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203) ~[spring-orm-3.2.8.RELEASE.jar:3.2.8.RELEASE]

... 52 common frames omitted

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure


The last packet successfully received from the server was 445,587 milliseconds ago.  The last packet sent successfully to the server was 18,300 milliseconds ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_55]

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_55]

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_55]

at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_55]

at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3715) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3604) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4155) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1307) ~[mysql-connector-java-5.1.30.jar:na]

at org.enhydra.jdbc.core.CorePreparedStatement.execute(CorePreparedStatement.java:82) ~[xapool-1.5.0.jar:"1.5.0"]

at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source) ~[na:na]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_55]

at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_55]

at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:62) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at com.sun.proxy.$Proxy16.execute(Unknown Source) ~[na:na]

at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221) ~[ibatis-sqlmap-2.3.4.726.jar:na]

at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189) ~[ibatis-sqlmap-2.3.4.726.jar:na]

... 59 common frames omitted

Caused by: java.net.SocketException: Operation timed out

at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.7.0_55]

at java.net.SocketInputStream.read(SocketInputStream.java:152) ~[na:1.7.0_55]

at java.net.SocketInputStream.read(SocketInputStream.java:122) ~[na:1.7.0_55]

at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:112) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:159) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:187) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3158) ~[mysql-connector-java-5.1.30.jar:na]

at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3615) ~[mysql-connector-java-5.1.30.jar:na]

... 75 common frames omitted

望大神指教

加载中
0
悲欢灬离合
悲欢灬离合

同问  我的还有Connection has been abandoned PooledConnection这个异常


0
1
1505412718

这是连接空闲了一段时间后自动超时了

jdbc url加上以下参数

autoReconnect=true

还会报错但不影响使用

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部