现象:
mysql端数据库查询很少.
页面端 报502错误.
后台统计连接池爆的日志很多.
$grep -c "Timeout waiting for idle object" err.log
5446
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNested
Exception: Cannot get a connection, pool error Timeout waiting for idle object
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:336)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
本文探讨了MySQL数据库查询效率低下导致的页面端502错误问题,通过日志分析发现连接池资源耗尽,重点解析了Spring框架中事务管理与连接池错误的关联,提供了解决方案。

788

被折叠的 条评论
为什么被折叠?



