1 Reply Latest reply on Apr 1, 2004 6:46 AM by Michael Arnett

    Network Problem while accessing database: Connection reset b

    Arpit Mittal Newbie

      Hi ,

      I have an application successfully deployed and running on the JBoss3.2.3 server. Now when the network goes down and resumes up the
      application faces the following problem:

      Connection reset by peer: socket write error

      Now i have to restart the server and then everything works fine.

      Do anyone have solution to this problem.
      Please reply

      -Regards
      Arpit Mittal

      PS: the detail of the error is as follows:-


      15:37:36,570 ERROR [STDERR] java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error
      15:37:36,602 ERROR [STDERR] at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
      15:37:36,602 ERROR [STDERR] at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
      15:37:36,602 ERROR [STDERR] at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
      15:37:36,602 ERROR [STDERR] at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.submitRequest(Unknown Source)
      15:37:36,602 ERROR [STDERR] at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.rollbackTransaction(Unknown Source)
      15:37:36,602 ERROR [STDERR] at com.microsoft.jdbc.base.BaseConnection.rollback(Unknown Source)
      15:37:36,602 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:118)
      15:37:36,617 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.rollback(TxConnectionManager.java:832)
      15:37:36,617 ERROR [STDERR] at org.jboss.tm.TransactionImpl.rollbackResources(TransactionImpl.java:1664)
      15:37:36,617 ERROR [STDERR] at org.jboss.tm.TransactionImpl.rollback(TransactionImpl.java:458)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:390)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      15:37:36,617 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:700)
      15:37:36,617 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      15:37:36,617 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      15:37:36,617 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      15:37:36,617 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
      15:37:36,617 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      15:37:36,617 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      15:37:36,617 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
      15:37:36,617 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
      15:37:36,617 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      15:37:36,617 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
      15:37:36,617 ERROR [STDERR] at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
      15:37:36,617 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      15:37:36,617 ERROR [STDERR] at $Proxy50.processRequest(Unknown Source)
      15:37:36,617 ERROR [STDERR] at com.igt.action.mst.AircraftMainAC.populateCollection(AircraftMainAC.java:349)
      15:37:36,617 ERROR [STDERR] at com.igt.action.mst.AircraftMainAC.execute(AircraftMainAC.java:90)
      15:37:36,617 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
      15:37:36,633 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
      15:37:36,633 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      15:37:36,633 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
      15:37:36,649 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      15:37:36,649 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:37:36,649 ERROR [STDERR] at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:37:36,649 ERROR [STDERR] at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:37:36,649 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      15:37:36,649 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      15:37:36,649 ERROR [STDERR] at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
      15:37:36,649 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
      15:37:36,649 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
      15:37:36,649 ERROR [STDERR] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
      15:37:36,649 ERROR [STDERR] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
      15:37:36,649 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)

        • 1. Re: Network Problem while accessing database: Connection res
          Michael Arnett Newbie

          It may be helpful to post your mssql-ds.xml file, but without seeing it, mt guess is that you need to an exceptionsorter and a check-valid-sql tag to your mssql-ds.xml. Something like this:
          <local-tx-datasource>
          <jndi-name>someDataSource</jndi-name>
          <connection-url>
          jdbc:microsoft:sqlserver://someUrl:1433;DatabaseName=someDb;SelectMethod=cursor
          </connection-url>
          <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
          <user-name>someUser</user-name>
          somePass
          <exception-sorter-class-name>
          com.yourpkg.SqlServerExceptionSorter
          </exception-sorter-class-name>
          <min-pool-size>10</min-pool-size>
          <max-pool-size>20</max-pool-size>
          <valid-connection-sql>
          select count(*) from SomeConnectionTest
          </valid-connection-sql>
          </local-tx-datasource>

          The sql used should be very fast. In my example SomeConnectionTest is a one column table with only one row that is never changed. Also, you will have to develop an ExceptionSorter, but there are several examples in the docs directory. Essentially, try this:

          public class SqlServerExceptionSorter implements ExceptionSorter, Serializable
          {
          public SqlServerExceptionSorter()
          {
          } // SqlServerExceptionSorter constructor

          public boolean isExceptionFatal(SQLException e)
          {
          return true;
          }
          } // SqlServerExceptionSorter


          if you want all Exceptions thrown to force the Connection to be removed from the connection pool.
          Finally, a search for ExceptionSorter and valid-connection-sql on this forum will result in a lot of answers to this situation that may have more helpful info.

          Hope this all helps,
          -MLA