2 Replies Latest reply on Sep 16, 2008 7:34 AM by Sascha Becher

    Persisting needs threads to be synchronized?

    Sascha Becher Newbie

      I'm using a simple client/server application for persisting data into a database. Server, Client and database run on the same machine.
      In a for() loop of my client a bean class method is called to persist entities.

      On jBoss 4.2.2 this all works fine, but on 4.2.3 after several thousand .persist()
      calls, it ends with this exception on the client:

      
      ERROR - Can not get connection to server. Problem establishing socket connection for InvokerLocator
      [socket://127.0.0.1:3873/]
      org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing so
      cket connection for InvokerLocator [socket://127.0.0.1:3873/]
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.
      java:579)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:6
      7)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.insert(Unknown Source)
       at com.qualitype.qualitrail.tools.katmigration.listener.ImportEventListener.insertRow(ImportEventLi
      stener.java:391)
       at com.qualitype.qualitrail.tools.katmigration.listener.ImportEventListener.onRowEnd(ImportEventLis
      tener.java:184)
       at com.qualitype.qualitrail.tools.katmigration.parser.ImportXmlParser.handleElementEnd(ImportXmlPar
      ser.java:116)
       at com.qualitype.qualitrail.tools.katmigration.parser.ImportXmlParser.parse(ImportXmlParser.java:76
      )
       at com.qualitype.qualitrail.tools.katmigration.KatClient.importXmlFile(KatClient.java:784)
       at com.qualitype.qualitrail.tools.katmigration.KatClient.start(KatClient.java:137)
       at com.qualitype.qualitrail.tools.katmigration.KatClient.main(KatClient.java:66)
      Caused by: java.net.BindException: Address already in use: connect
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at java.net.PlainSocketImpl.doConnect(Unknown Source)
       at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
       at java.net.PlainSocketImpl.connect(Unknown Source)
       at java.net.SocksSocketImpl.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:19
      2)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvo
      ker.java:827)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.
      java:569)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:6
      7)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.insert(Unknown Source)
       at com.qualitype.qualitrail.tools.katmigration.listener.ImportEventListener.insertRow(ImportEventLi
      stener.java:391)
       at com.qualitype.qualitrail.tools.katmigration.listener.ImportEventListener.onRowEnd(ImportEventLis
      tener.java:184)
       at com.qualitype.qualitrail.tools.katmigration.parser.ImportXmlParser.handleElementEnd(ImportXmlPar
      ser.java:116)
       at com.qualitype.qualitrail.tools.katmigration.parser.ImportXmlParser.parse(ImportXmlParser.java:76
      )
       at com.qualitype.qualitrail.tools.katmigration.KatClient.importXmlFile(KatClient.java:784)
       at com.qualitype.qualitrail.tools.katmigration.KatClient.start(KatClient.java:137)
       at com.qualitype.qualitrail.tools.katmigration.KatClient.main(KatClient.java:66)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       ... 16 more
      Time elapsed: 68 seconds
      
      



      Waiting a second or two after this happens, persisting of entities is working again.
      It seems, as if there is a queue getting full. This behaviour is new to me, since
      I thought I don't have to take care on the time, the database needs for it's
      workload. Shouldn't calls on the bean stall my client thread until the bean
      finished it's work?

      Switching back to jBoss 4.2.2 (and Java 1.5) it works as expected.

      Can somebody please help? I'm new to the whole thing.