4 Replies Latest reply on Jul 11, 2008 1:16 AM by Ron Sigal

    java.net.SocketException: Can not obtain client socket conne

    Kapil Singhal Newbie

      Hello,

      I am having JBoss 4.2.2 GA, PostgrsSQL 8.2 and Jboss Remoting version 2.2.2 SP1.

      I want to connect 64 clients to the JBoss Server but after creating 50 sessions / connections, it is giving the exception on the Client side.

      The exception is as follows:

      Exception in thread "main" org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://150.158.74.104:3873/]
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:532)
      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.subscribeSystem(Unknown Source)
      at com.barco.cms.perspectivemgtproxy.eventsupport.SystemEventSupport.subscribeSystem(SystemEventSupport.java:180)
      at com.barco.cms.perspectivemgtproxy.PerspectiveMgt.subscribe(PerspectiveMgt.java:328)
      at com.barco.cms.performanceclt.MethodExecuter.<init>(MethodExecuter.java:54)
      at com.barco.cms.performanceclt.Test.main(Test.java:37)
      Caused by: java.net.SocketException: Can not obtain client socket connection from pool. Have waited 30012 milliseconds for available connection (50in use)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:862)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:525)
      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.subscribeSystem(Unknown Source)
      at com.barco.cms.perspectivemgtproxy.eventsupport.SystemEventSupport.subscribeSystem(SystemEventSupport.java:180)
      at com.barco.cms.perspectivemgtproxy.PerspectiveMgt.subscribe(PerspectiveMgt.java:328)
      at com.barco.cms.performanceclt.MethodExecuter.<init>(MethodExecuter.java:54)
      at com.barco.cms.performanceclt.Test.main(Test.java:37)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
      ... 13 more


      I have gone thru various tutorials but not able to manage more than 50 connections.

      I have modified the jboss-service.xml also for <max-pool-size> and , but it is still stuck to 50 connections.

      Please reply asap.
      Any help will be appreciated.

      Thanks & Regards,
      Kapil




        • 1. Re: java.net.SocketException: Can not obtain client socket c
          Kapil Singhal Newbie

          I updated the jboss-remoting.jar to 2.4.0 as suggested in the JIRA JREM 821.

          After updating the jar, I am getting the connections upto 64 but after 50 connections it slows down a lot. It takes around 7-10 min. for last 15 connections.

          This behaviour is very strange.

          Can we configure the MAX_POOL_SIZE from any of the configuration files in the JBoss?

          I looked into the class "MicroSocketclientInvoker.java" and found that the default value of the POOL_SIZE is 50.

          I do not know but I think this default value is restrciting the connections to 50 only.

          Can someone suggest how to proceed further.

          I have also updated the PostgreSQL to 8.3.1 but it is still stuck to 50 connections.

          Thanks,
          Kapil

          • 2. Re: java.net.SocketException: Can not obtain client socket c
            Ron Sigal Master

            You're right about maxPoolSize restricting the number of connections from a client to the server. Maybe you've haven't configured it in the right place - there are several jboss-service.xml files in the Application Server directory. You want ${JBOSS_HOME}/server/${CONFIG}/deploy/ejb3.deployer/META-INF/jboss-service.xml, where you want to change the EJB3 Connector MBean:

             <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/?maxPoolSize=100</attribute>
             <attribute name="Configuration">
             <handlers>
             <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
             </handlers>
             </attribute>
             </mbean>
            


            where I set maxPoolSize=100 just for illustration.

            • 3. Re: java.net.SocketException: Can not obtain client socket c
              Kapil Singhal Newbie

              Hello Ron,

              I have modified the jboss-service.xml located at

              C:\Lang\JBoss\jboss-4.2.2.GA\server\default\deploy\ejb3.deployer\META-INF
              as follows:

              <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/?maxPoolSize=200</attribute>
               <attribute name="Configuration">
               <handlers>
               <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
               </handlers>
               </attribute>
               </mbean>


              But the problem still persists...

              I have tried with both the versions of jboss-remoting.jar - 2.2.2 & 2.4.0
              In case of 2.2.2 it is throwing exception after 50 connections and in case of 2.4.0 it is behaving same as I last mentioned - after 50 it slowed down.

              I have changed in the default\deploy\ejb3.deployer and all\deploy\ejb3.deployer folder after it was not working in the default folder. My ejb3 is deployed in the default folder.

              Please suggest if some more changes are required, as this change is not working.

              Regards,
              Kapil


              • 4. Re: java.net.SocketException: Can not obtain client socket c
                Ron Sigal Master

                My mistake: the parameter is "clientMaxPoolSize":

                 <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/?clientMaxPoolSize=200</attribute>
                 <attribute name="Configuration">
                 <handlers>
                 <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
                 </handlers>
                 </attribute>
                 </mbean>