ssh框架mysql连接出错_ssh框架的一个数据库连接问题

开始能正常运行一段时间,用户稍微多一下之后就出现问题,而且此时无法用tomcat的manager重启项目,数据库是mysql5,tomcat5.5

spring的hibernate配置如下

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"

xmlns:aop="http://www.springframework.org/schema/aop"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd

">

destroy-method="close">

value="jdbc:mysql://localhost:3306/epcs?useUnicode=true&characterEncoding=GBK">

class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

classpath:/com/leader/epfs/hbm

org.hibernate.dialect.MySQL5Dialect

org.hibernate.cache.EhCacheProvider

true

auto

true

true

true

class="org.springframework.orm.hibernate3.HibernateTransactionManager">

advice-ref="txAdvice" />

错误信息如下:

11:10:19,968  WARN JDBCExceptionReporter:77 - SQL Error: 0, SQLState: null

11:10:19,968 ERROR JDBCExceptionReporter:78 - An attempt by a client to checkout a Connection has timed out.

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection

at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:550)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377)

at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

at $Proxy16.getObject(Unknown Source)

at com.leader.epfs.struts.action.cr.CrCreditAction.showstatus(CrCreditAction.java:468)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)

at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)

at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)

at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)

at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)

at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)

at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)

at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)

at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Unknown Source)

Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection

at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)

at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)

at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)

at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)

at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)

at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:509)

... 80 more

Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.

at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)

at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:527)

at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)

at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)

at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)

... 85 more

Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@136bdda -- timeout at awaitAvailable()

at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1317)

at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)

at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)

... 88 more

远程用manager启动项目时报错

log4j:ERROR Error occured while converting date.

java.lang.NullPointerException

at java.lang.System.arraycopy(Native Method)

at java.lang.AbstractStringBuilder.getChars(Unknown Source)

at java.lang.StringBuffer.getChars(Unknown Source)

at org.apache.log4j.helpers.AbsoluteTimeDateFormat.format(AbsoluteTimeDateFormat.java:117)

at java.text.DateFormat.format(Unknown Source)

at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)

at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)

at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)

at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)

at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)

at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)

at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)

at org.apache.log4j.Category.callAppenders(Category.java:203)

at org.apache.log4j.Category.forcedLog(Category.java:388)

at org.apache.log4j.Category.log(Category.java:853)

at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)

at org.apache.catalina.core.ApplicationContext.log(ApplicationContext.java:638)

at org.apache.catalina.core.ApplicationContextFacade.log(ApplicationContextFacade.java:249)

at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:358)

at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:70)

at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3768)

at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4310)

at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:892)

at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1159)

at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1131)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:312)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1053)

at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1065)

at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:447)

at org.apache.catalina.core.StandardService.stop(StandardService.java:512)

at org.apache.catalina.core.StandardServer.stop(StandardServer.java:734)

at org.apache.catalina.startup.Catalina.stop(Catalina.java:601)

at org.apache.catalina.startup.Catalina.start(Catalina.java:576)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

问题补充:

mysql用的是win安装版,安装时选择最大连接模式。

问题补充:

系统中还使用了acegi框架

几位说的连接不释放是否于此有关?

xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"

default-autowire="byName">

always-use-default-target="true" />

filters="none" />

class="com.leader.epfs.daoimpl.dictionary.UserDetailsServiceImpl">

问题补充:

应该不是8小时问题,挺不到8小时,连接数改成50也没有用。

mysql数据库安装时选择连接最大的那种模式的。

2009年2月17日 08:10

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值