0

我正在使用 Hibernate、Spring、JBOSS 和 Microsoft SQL Server 2008 R2。在看似随机的时间我得到一个错误

ERROR [http-0.0.0.0-8080-7] org.hibernate.util.JDBCExceptionReporter [JDBCExceptionReporter.java:101] Connection reset by peer: socket write error
2013-05-20 14:43:51,171 ERROR [http-0.0.0.0-8080-7] org.hibernate.transaction.JDBCTransaction [JDBCTransaction.java:202] JDBC rollback failed
com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170) ~[sqljdbc4.jar!/:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:304) ~[sqljdbc4.jar!/:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.setAutoCommit(SQLServerConnection.java:1592) ~[sqljdbc4.jar!/:na]
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkTransaction(BaseWrapperManagedConnection.java:545)
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:826) ~[jboss-common-jdbc-wrapper.jar!/:5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)]
at org.jboss.resource.adapter.jdbc.WrappedConnection.rollback(WrappedConnection.java:499)
at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217) ~[hibernate3.jar:3.5.4-Final]
at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196) ~[hibernate3.jar:3.5.4-Final]
at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.rollbackIfNecessary(HibernateLocalTxnInterceptor.java:149) 
at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.invoke(HibernateLocalTxnInterceptor.java:72) 
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:72) [guice-3.0.jar:na]
at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:52) [guice-3.0.jar:na]
at com.MyClassA$$EnhancerByGuice$$6f61ba26.getDefaultSettings(<generated>) [guice-3.0.jar:na]
at com.MyClassB.getDefaultSettings(MyClassB.java:155) [classes:na]
at com.MyClassBImpl.getDefaultSettings(MyClassBImpl.java:106) [classes:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246) [webservices-rt.jar:1.0]
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146) [webservices-rt.jar:1.0]
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257) [webservices-rt.jar:1.0]
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95) [webservices-rt.jar:1.0]
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629) [webservices-rt.jar:1.0]
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588) [webservices-rt.jar:1.0]
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573) [webservices-rt.jar:1.0]
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470) [webservices-rt.jar:1.0]
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295) [webservices-rt.jar:1.0]
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:519) [webservices-rt.jar:1.0]
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:288) [webservices-rt.jar:1.0]
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143) [webservices-rt.jar:1.0]
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:155) [webservices-rt.jar:1.0]
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:189) [webservices-rt.jar:1.0]
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:76) [webservices-rt.jar:1.0]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) 
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) 
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) 
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 
at java.lang.Thread.run(Thread.java:662) 

自上两周以来一直在研究此问题,但无法找出根本原因。任何帮助将不胜感激。

编辑:现在编辑服务器超时后,我收到以下异常

WARNING [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-26-thread-7) ConnectionID:4 TDS header contained invalid packet length:12590; packet size:8000
2013-05-21 15:59:15,777 SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-26-thread-7) ConnectionID:4 got unexpected value in TDS response at offset:7992
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) Exception in thread "pool-25-thread-2" 
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) org.hibernate.TransactionException: JDBC rollback failed
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:204)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.rollbackIfNecessary(HibernateLocalTxnInterceptor.java:149)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.invoke(HibernateLocalTxnInterceptor.java:72)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at com.softpak.marserm.engine.library.impl.JobReportStatusUtil.updateReportStatus(Unknown Source)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at com.softpak.marserm.engine.library.impl.ExecutableJob.run(Unknown Source)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at java.lang.Thread.run(Thread.java:662)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:304)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at com.microsoft.sqlserver.jdbc.SQLServerConnection.rollback(SQLServerConnection.java:1655)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:697)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at org.jboss.resource.adapter.jdbc.WrappedConnection.rollback(WrappedConnection.java:500)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2)   ... 7 more

错误日志的第二次编辑

SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.TOKEN] (pool-27-thread-7) ConnectionID:1: FetchBufferTokenHandler: Encountered unexpected unknown token (0x30)
SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-27-thread-7) ConnectionID:1 got unexpected value in TDS response at offset:7282
SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.TOKEN] (pool-27-thread-7) ConnectionID:1: getNextResult: Encountered unexpected unknown token (0x30)
SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-27-thread-7) ConnectionID:1 got unexpected value in TDS response at offset:7282
4

2 回答 2

0

您尝试获取的数据太大而无法放入数据包/或已损坏

警告 [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-26-thread-7) ConnectionID:4 TDS header contains invalid packet length:12590; 数据包大小:8000

根据您使用的 JDBC 驱动程序,您可能需要调整它的一些参数。

mssql JDBC 驱动程序的配置信息

于 2013-05-21T12:08:54.913 回答
0

就我而言,我有一个巨大的只进游标,我可以通过在 jdbc 连接字符串中指定 SelectMethod=cursor 并在 Java 端检索选择结果之前指定 setFetchSize 来克服这个问题。

于 2020-05-12T11:35:12.640 回答