日期:2014-05-16  浏览次数:20611 次

mysql连接不上导致jdbc blocked的问题

今天线上使用开发环境配置导致mysql 链接不上的错误:

"dboss-worker-thread-6" prio=10 tid=0x00002aaac0310000 nid=0x28e3 waiting for monitor entry [0x000000004440a000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1361)
	- waiting to lock <0x00000007980d41c8> (a org.apache.commons.dbcp.BasicDataSource)
	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)
	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:797)
	at com.duitang.biz.blog.impl.BlogQueryServiceImpl.queryBlogCoreById(BlogQueryServiceImpl.java:599)
	at com.duitang.biz.blog.impl.BlogQueryServiceImpl.queryBlogTiny(BlogQueryServiceImpl.java:741)
	at com.duitang.views.CommentService.queryCommentsByBlogs(CommentService.java:146)
	at com.duitang.biz.blog.impl.CommentQueryServiceImpl.queryComent(CommentQueryServiceImpl.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	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)
	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)

"dboss-worker-thread-4" prio=10 tid=0x0000000048437000 nid=0x28e1 waiting for monitor entry [0x0000000044208000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1361)
	- waiting to lock <0x00000007980d41c8> (a org.apache.commons.dbcp.BasicDataSource)
	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)
	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.co