`
san_yun
  • 浏览: 2663561 次
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

java.sql.SQLException: Data source is closed

 
阅读更多

最近遇到这个Spring datasouces closed的错误:

 

[admin@server4 ~]$ tail -300 /duitang/logs/usr/crawler/crawler.log
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.duitang.dboss.service.ServiceInvoker.doaccept2(ServiceInvoker.java:127)
	... 10 more
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Data source is closed
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:714)
	at org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:785)
	at com.duitang.biz.common.SqlServiceImpl.queryForLong(SqlServiceImpl.java:262)
	... 14 more
Caused by: java.sql.SQLException: Data source is closed
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1362)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
	at com.duitang.common.data.RouterDataSource.getConnection(RouterDataSource.java:103)
	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
	... 21 more

ERROR 08-21 10:03:59 item:171 dboss invoke ERROR: url =dboss2://sqlService/queryForLong?q=%5B%22select+id+from+message_messagesource+where+img_src_sum+%3D+%3F%22%2C+%22%5B%5C%22e6e01b2184f47acca40dcfb0476b5d15%5C%22%5D%22%5D 
 message=500com.duitang.dboss.remote.oio.DbossException: java.lang.reflect.InvocationTargetException
	at com.duitang.dboss.service.ServiceInvoker.doaccept2(ServiceInvoker.java:136)
	at com.duitang.dboss.service.ServiceInvoker.accept(ServiceInvoker.java:46)
	at com.duitang.dboss.remote.nio.DbossServerHandler.messageReceived(DbossServerHandler.java:40)
	at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:98)
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
	at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:796)
	at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:69)
	at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:307)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedMethodAccessor256.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.duitang.dboss.service.ServiceInvoker.doaccept2(ServiceInvoker.java:127)
	... 10 more
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Data source is closed
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:714)
	at org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:785)
	at com.duitang.biz.common.SqlServiceImpl.queryForLong(SqlServiceImpl.java:262)
	... 14 more
Caused by: java.sql.SQLException: Data source is closed
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1362)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
	at com.duitang.common.data.RouterDataSource.getConnection(RouterDataSource.java:103)
	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
	... 21 more

 

Caused by: org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in com/duitang/model/mysql/blog/AlbumDO.xml.
--- The error occurred while executing query.
--- Check the                     select id,status,category,user_id,name,count,like_count,comment_count,album_album.desc,create_datetime from album_album          where id =?                    .
--- Check the SQL Statement (preparation failed).
--- Cause: java.sql.SQLException: Data source is closed; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/duitang/model/mysql/blog/AlbumDO.xml.
--- The error occurred while executing query.
--- Check the                     select id,status,category,user_id,name,count,like_count,comment_count,album_album.desc,create_datetime from album_album          where id =?                    .
--- Check the SQL Statement (preparation failed).
--- Cause: java.sql.SQLException: Data source is closed
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:268)
    at com.duitang.model.mysql.AlbumDAO.findById(AlbumDAO.java:28)
    at com.duitang.biz.blog.impl.AlbumQueryServiceImpl.findAlbum(AlbumQueryServiceImpl.java:533)

 

原因是远程服务已经退出。

 

分享到:
评论
1 楼 王佳伟 2014-07-08  
请问下,你是怎么解决这个问题的啊?求回复啊!!!

相关推荐

Global site tag (gtag.js) - Google Analytics