3 Replies Latest reply on Aug 31, 2011 11:49 PM by Wen Cheng

    Problem establishing socket connection for InvokerLocator

    Wen Cheng Newbie

      hello, all

       

          Today I am confused by a problem.  I am trying to migrate my project form JBoss 4.0.4 to JBoss AS 6.0.0 Final these days. With JBoss 6 and ejb3, now everything looks fine except one:

       

           The testing code is as below:

       

       try {
      
                Properties jndiProps = new Properties();
                jndiProps.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
                jndiProps.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
                jndiProps.put("java.naming.provider.url","localhost");
      
                 InitialContext ctx = new InitialContext(jndiProps);
      
                 ReflectEJBTest bean  = (ReflectEJBTest) ctx.lookup("ReflectEJBBeanTest/remote");
      
                 bean.login("admin", "123456", true);
      
       } catch (Exception e) {
                 e.printStackTrace ();   
       }
      

       

          if I just double click /%jboss_home%/bin/run.bat to run jboss,  the testing code works fine.

       

          However, if I run the bat with parameters like this:

       

          run.bat -c default
      

       

         Then,  the code shows exceptions:

       

      javax.naming.NamingException: Could not dereference object [Root exception is org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://Eowyn_Computer/?timeout=300000]]
          at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1504)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
          at javax.naming.InitialContext.lookup(InitialContext.java:392)
          at mytest.LoginTest.main(LoginTest.java:430)
      Caused by: org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://Eowyn_Computer/?timeout=300000]
          at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:776)
          at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
          at org.jboss.remoting.Client.invoke(Client.java:1724)
          at org.jboss.remoting.Client.invoke(Client.java:629)
          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.proxy.impl.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:72)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
          at $Proxy0.createProxyBusiness(Unknown Source)
          at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129)
          at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
          at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:158)
          at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
          at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479)
          at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496)
          ... 4 more
      Caused by: java.lang.IllegalArgumentException: port out of range:-1
          at java.net.InetSocketAddress.<init>(InetSocketAddress.java:118)
          at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:197)
          at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:1089)
          at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:762)
          at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
          at org.jboss.remoting.Client.invoke(Client.java:1724)
          at org.jboss.remoting.Client.invoke(Client.java:629)
          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.proxy.impl.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:72)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
          at $Proxy0.createProxyBusiness(Unknown Source)
          at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129)
          at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
          at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:158)
          at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
          at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479)
          at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
          at javax.naming.InitialContext.lookup(InitialContext.java:392)
          at mytest.LoginTest.main(LoginTest.java:430)
          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
          ... 15 more
      

       

          I ontice the message:

       

      Can not get connection to server. 
      
      Problem establishing socket connection for InvokerLocator 
      
      [socket://Eowyn_Computer/?timeout=30000
      

       

           Eowyn_Computer is my computer name. I don't think the "socket://Eowyn_Computer/?timeout=30000" is correct. But why?

       

       

           Because I need to run multi instance in the project, parameters like "-c  serverNode" are necessary.

       

           I guess I missed something, mayby some configuration files?

       

           Any one can help? Or any advices?

       

           Thanks very, very much!

        • 1. Re: Problem establishing socket connection for InvokerLocator
          Wen Cheng Newbie

          I fixed it. It's because my computer Name "Eowyn_Computer" has invalid charcters. After I change it to "Eowyn", everything works fine.

          • 2. Re: Problem establishing socket connection for InvokerLocator
            Siddu Bulla Newbie

            Hi Wen,

             

            I am also facing the same issue but its my first time adding SSL to EJB3.

            Can you please share the other configuration details to be made ?

             

            AT present,

            I have added the below code into ejb3-connectrs-jboss-beans.xml

              <bean name="org.jboss.ejb3.RemotingConnector"
                class="org.jboss.remoting.transport.Connector">

                <property name="invokerLocator">

                  <value-factory bean="ServiceBindingManager"
                    method="getStringBinding">
                    <parameter>
                      jboss.remoting:type=Connector,transport=socket3873,handler=ejb3
                    </parameter>
                    <parameter>
                      <null />
                    </parameter>
                    <parameter>sslsocket://0.0.0.0:3874</parameter>
                    <parameter>
                      <null />
                    </parameter>
                    <parameter>3874</parameter>
                  </value-factory>

                </property>
                <property name="serverConfiguration">
                  <inject bean="ServerConfiguration" />
                </property>
            <property name="serverSocketFactory">
                  <inject bean="sslServerSocketFactory" />
                </property>
              </bean>

             

            the server is getting ON but then I try to access the EJB its giving me the same error as yours.

             

            Can you please help me.

             

            thanks in advance,

            Siddu

            • 3. Re: Problem establishing socket connection for InvokerLocator
              Wen Cheng Newbie

              Hello, Siddu:

               

                   When I wrote this post, my ejb3 was run without SSL. So I don't know if it's the same with your problem.

                  

                  But these days , I am working on adding SSL to my ejb3. My configurations and problems was on:

                  http://community.jboss.org/message/622861#622861

                  Please read it to see if It can help.

               

                  I tried a lot of configurations, and finally I fixed all problems now. If your EJB3+SSL is still not running well, you can ask me.Hope I can help you.