4 Replies Latest reply on Mar 1, 2009 2:19 AM by ron_sigal

    CannotConnectException/BindException on running clients

    vink

      Hello,

      I'm running my client on windows which is looking-up a stateless EJB & stressing calls on it, installed on JBoss 4.2.2.GA using JBoss Remoting 2.2.2.SP1.

      After running several clients for a while I'm encounting the following exception;

      Exception in thread "main" org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://NOICLT13407: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:67)
      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.listSources(Unknown Source)
      at MarshalTest.main(MarshalTest.java:44)
      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:192)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.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:67)
      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.listSources(Unknown Source)
      at MarshalTest.main(MarshalTest.java:44)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
      ... 10 more

      Please suggest what changes I make in order to avoid this exception. My client is working with SLSB only & the nature of my client is to work in 24x7 mode. No call should bounce, as my application demands the availability of the server.

        • 1. Re: CannotConnectException/BindException on running clients
          vink

          It is working now. I've changed to Remoting 2.4.0.SP1. But I need to tune timeouts in EJB3 connector configuration.

          • 2. Re: CannotConnectException/BindException on running clients
            green804

            Did you tune the timeouts in the EJB connectors? If so, what did you change that resolved this issue?

            • 3. Re: CannotConnectException/BindException on running clients
              vink

              Prior to 2.4.0.SP1, every call to SLSB was creating a socket; as a result system run out of sockets & it throws cannot connect exception.

              I migrated to this version who claimed to solve this bug. Also this version exposed an extra attribute "invokerDestructionDelay", which is used for reusing the socket connection for a given delay.

              I've just added this attribute to the default configuration & my system is running without any issues. This attribute is optional, you can just try this new version of remoting.

              <mbean code="org.jboss.remoting.transport.Connector"
               name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
               <depends>jboss.aop:service=AspectDeployer</depends>
               <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873/?invokerDestructionDelay=5000</attribute>
               <attribute name="Configuration">
               <handlers>
               <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
               </handlers>
               </attribute>
               </mbean>


              • 4. Re: CannotConnectException/BindException on running clients
                ron_sigal

                Hey, "vink", thanks for contributing. -Ron