tomcat链接mysql时超时报错java.io.EOFException: Can not read response from server. Expected to read 4 bytes,

需要在配置文件里加上下面就ok了
<property name=”minEvictableIdleTimeMillis” value=”1800000″ />
<property name=”numTestsPerEvictionRun” value=”3″ />
<property name=”testOnBorrow” value=”true” />
<property name=”testWhileIdle” value=”true” />
<property name=”testOnReturn” value=”true” />
<property name=”validationQuery” value=”SELECT 1″ />
阅读更多

mysql 链接问题 Expected to read 4 bytes, read 0 bytes

04-12

** BEGIN NESTED EXCEPTION ** rnrnjava.io.EOFExceptionrnMESSAGE: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.rnrnSTACKTRACE:rnrnjava.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.rn at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1997)rn at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2411)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2916)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)rn at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)rn at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:5442)rn at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)rn at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:91)rn at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)rn at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at $Proxy9.getWebsite(Unknown Source)rn at com.blhd.core.web.CookieIdentityInterceptor.doIntercept(CookieIdentityInterceptor.java:46)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.blhd.common.struts2.interceptor.DomainNameInterceptor.doIntercept(DomainNameInterceptor.java:24)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.blhd.common.struts2.interceptor.ProcessingStartInterceptor.intercept(ProcessingStartInterceptor.java:32)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:532)rn at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)rn at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)rn at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)rn at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)rn at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)rn at java.lang.Thread.run(Thread.java:619)rnrnrn** END NESTED EXCEPTION **rn有人说是C3P0问题 可是我也那样做了不行rnbean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn

没有更多推荐了,返回首页