13 Replies Latest reply on Mar 21, 2012 3:43 AM by jw

    JMS Remote Client  not able to connect

    Noa Drach Novice

      Hello,

       

      • I have remote client that tries to connect to a queue on JBOSS 7.1.0.Final
      • the client path includes the jboss-client-7.1.0.Final.jar
      • On the client log I get the following error:

       

      javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]
        at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
        at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:117)
        ...
        at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.RuntimeException: Operation failed with status WAITING
        at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89)
        at org.jboss.naming.remote.client.cache.ConnectionCache.get(ConnectionCache.java:42)
        at org.jboss.naming.remote.client.InitialContextFactory.createConnection(InitialContextFactory.java:153)
        at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateConnection(InitialContextFactory.java:126)
        at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:106)
        ... 13 more
      
      
      • On the server side I see this error

       

      JBREM000200: Remote connection failed: java.io.IOException: Received an invalid message length of 1195725856
      

       

      can someone direct me as to what should I look for?

       

      Thanks,

      Noa

        • 1. Re: JMS Remote Client  not able to connect
          Noa Drach Novice

          One update

           

          this error happens when I run the code from a machine other than the machine jboss is running on.

           

          when I run it on the same machine it works.

           

          I added the following lines to standalone.conf.bat and since I actually see error in the server side, I assume that the initial connection was created and this is another problem

           

           

          set "JAVA_OPTS=%JAVA_OPTS% -Djboss.bind.address=0.0.0.0"
          set "JAVA_OPTS=%JAVA_OPTS% -Djboss.bind.address.management=0.0.0.0"
          
          
          • 2. Re: JMS Remote Client  not able to connect
            jaikiran pai Master

            The remoting connector is secured by default. So you'll have to first create a user to add to the ApplicationRealm (which the connector uses) using the add-user script and then pass the user/pass information through the JNDI context properties Context.PRINCIPAL and Context.CREDENTIAL (or you can use a callbackhandler to do that).

            • 3. Re: JMS Remote Client  not able to connect
              Noa Drach Novice

              I already set the user and role as necessary -

              user:noa

              role:guest

              ApplicationRealm

               

              when I run this main from the same machine running on jboss I get the following output:

               

              Trying to get initial context
              Feb 22, 2012 3:10:17 PM org.xnio.Xnio <clinit>
              INFO: XNIO Version 3.0.3.GA
              Feb 22, 2012 3:10:18 PM org.xnio.nio.NioXnio <clinit>
              INFO: XNIO NIO Implementation Version 3.0.3.GA
              Feb 22, 2012 3:10:18 PM org.jboss.remoting3.EndpointImpl <clinit>
              INFO: JBoss Remoting version 3.2.2.GA
              Have inital context
              success
              Elapsed time = 870 milliseconds
              
              

              when I run it from another machine this is the output I get:

               

              Trying to get initial context
              Feb 22, 2012 3:04:55 PM org.xnio.Xnio <clinit>
              INFO: XNIO Version 3.0.3.GA
              Feb 22, 2012 3:04:55 PM org.xnio.nio.NioXnio <clinit>
              INFO: XNIO NIO Implementation Version 3.0.3.GA
              Feb 22, 2012 3:04:55 PM org.jboss.remoting3.EndpointImpl <clinit>
              INFO: JBoss Remoting version 3.2.2.GA
              fail
              javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING
              ]
                      at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
                      at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:117)
                      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
                      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
                      at javax.naming.InitialContext.init(InitialContext.java:223)
                      at javax.naming.InitialContext.<init>(InitialContext.java:197)
                      at my.test.Connect2Queue.main(Connect2Queue.java:27)
              Caused by: java.lang.RuntimeException: Operation failed with status WAITING
                      at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89)
                      at org.jboss.naming.remote.client.cache.ConnectionCache.get(ConnectionCache.java:42)
                      at org.jboss.naming.remote.client.InitialContextFactory.createConnection(InitialContextFactory.java:153)
                      at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateConnection(InitialContextFactory.java:126)
                      at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:106)
                      ... 5 more
              Elapsed time = 5297 milliseconds
              
              

               

              My code is attached.

               

              i use the following settings to run it in both machine:

               

              classpath=.;%JBOSS_HOME%\bin\client\jboss-client-7.1.0.Final.jar
              java my.test.Connect2Queue .
              

               

              on the remote machine the whole jboss folders and structure exist but jboss is not running there.

               

              If I ping from the remote machine to the one running jboss this is what I get

               

               

                  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
              Approximate round trip times in milli-seconds:
                  Minimum = 0ms, Maximum = 1ms, Average = 0ms
              
              

               

              and I am also able to login into the jboss managment console from the remote machine - i know it's other realms, but i think that it's at list an indicator that I binded jboss correctly

              • 4. Re: JMS Remote Client  not able to connect
                Noa Drach Novice

                One update:

                 

                I switched between the machines so the client now is running on the machine that run jboss and jboss is running on the other machine

                 

                now i see that the initial context is made but the creation of the connection fails.

                 

                 

                Feb 23, 2012 4:26:32 PM org.xnio.nio.NioXnio <clinit>
                INFO: XNIO NIO Implementation Version 3.0.3.GA
                Feb 23, 2012 4:26:32 PM org.jboss.remoting3.EndpointImpl <clinit>
                INFO: JBoss Remoting version 3.2.2.GA
                Have inital context
                fail
                javax.jms.JMSException: Failed to create session factory
                          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)
                          at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)
                          at my.test.Connect2Queue.main(Connect2Queue.java:29)
                Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]
                          at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:769)
                          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)
                          ... 2 more
                Elapsed time = 2605 milliseconds
                
                

                 

                could it be related to - Hornetq2.2.2 client failed to create session factory to connect on server is it possible i need to add something to the acceptors area? i see the solution listed there describes adding a specific ip - I don't think it's a solution i can work with

                • 5. Re: JMS Remote Client  not able to connect
                  Nick Prusov Newbie

                  The original problem you had connected with this exception java.lang.RuntimeException: Operation failed with status WAITING is related to the fact that you need to change all default bind port 127.0.0.1 in your configuration file for instance standalone.xml  to the real IP address of the box Jboss is running on. Then you will be able to connect remotely and get remote JNDI using your client code.

                  • 6. Re: JMS Remote Client  not able to connect
                    Noa Drach Novice

                    After changing to the actual machine IP i now get

                    Trying to get initial context
                    Feb 28, 2012 4:45:15 PM org.xnio.Xnio <clinit>
                    INFO: XNIO Version 3.0.3.GA
                    Feb 28, 2012 4:45:15 PM org.xnio.nio.NioXnio <clinit>
                    INFO: XNIO NIO Implementation Version 3.0.3.GA
                    Feb 28, 2012 4:45:15 PM org.jboss.remoting3.EndpointImpl <clinit>
                    INFO: JBoss Remoting version 3.2.2.GA
                    Have inital context
                    fail
                    javax.jms.JMSException: Failed to create session factory
                            at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)
                            at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)
                            at my.test.Connect2Queue.main(Connect2Queue.java:29)
                    Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]
                            at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:769)
                            at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)
                            ... 2 more
                    Elapsed time = 1828 milliseconds
                    
                    

                     

                    I read around but didn't find a way to solve this problem, any suggestions here?

                    • 7. Re: JMS Remote Client  not able to connect
                      Nick Prusov Newbie

                      Please remove this if it is still true in your configuration, I see no point to use it

                       

                      set "JAVA_OPTS=%JAVA_OPTS% -Djboss.bind.address=0.0.0.0"
                      set "JAVA_OPTS=%JAVA_OPTS% -Djboss.bind.address.management=0.0.0.0"

                       

                      Please provide your configuration xml file you are using to start Jboss with.

                      • 8. Re: JMS Remote Client  not able to connect
                        Noa Drach Novice

                        attached is my configuration xml.

                         

                         

                        Nick Prusov wrote:

                         

                        Please remove this if it is still true in your configuration, I see no point to use it

                         

                        set "JAVA_OPTS=%JAVA_OPTS% -Djboss.bind.address=0.0.0.0"
                        set "JAVA_OPTS=%JAVA_OPTS% -Djboss.bind.address.management=0.0.0.0"

                         

                        Please provide your configuration xml file you are using to start Jboss with.

                        I removed those lines and now even connecting from the same machine fails.

                         

                        the failures come in 2 flavors:

                         

                        if the address given to the initail context creation is using the machine name - "remote://my_machine:4447" or the actual IP I get

                         

                        Feb 29, 2012 8:00:09 PM org.xnio.nio.NioXnio <clinit>
                        INFO: XNIO NIO Implementation Version 3.0.3.GA
                        Feb 29, 2012 8:00:09 PM org.jboss.remoting3.EndpointImpl <clinit>
                        INFO: JBoss Remoting version 3.2.2.GA
                        Have inital context
                        fail
                        javax.jms.JMSException: Failed to create session factory
                                  at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)
                                  at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)
                                  at my.test.Connect2Queue.main(Connect2Queue.java:29)
                        Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]
                                  at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:769)
                                  at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)
                                  ... 2 more
                        Elapsed time = 1688 milliseconds
                        
                        

                         

                        if I use localhost - "remote://localhost:4447" I get this error:

                         

                        Trying to get initial context
                        Feb 29, 2012 8:01:52 PM org.xnio.Xnio <clinit>
                        INFO: XNIO Version 3.0.3.GA
                        Feb 29, 2012 8:01:52 PM org.xnio.nio.NioXnio <clinit>
                        INFO: XNIO NIO Implementation Version 3.0.3.GA
                        Feb 29, 2012 8:01:52 PM org.jboss.remoting3.EndpointImpl <clinit>
                        INFO: JBoss Remoting version 3.2.2.GA
                        fail
                        javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]
                                  at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
                                  at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:117)
                                  at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
                                  at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
                                  at javax.naming.InitialContext.init(InitialContext.java:223)
                                  at javax.naming.InitialContext.<init>(InitialContext.java:197)
                                  at my.test.Connect2Queue.main(Connect2Queue.java:24)
                        Caused by: java.lang.RuntimeException: Operation failed with status WAITING
                                  at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89)
                                  at org.jboss.naming.remote.client.cache.ConnectionCache.get(ConnectionCache.java:42)
                                  at org.jboss.naming.remote.client.InitialContextFactory.createConnection(InitialContextFactory.java:153)
                                  at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateConnection(InitialContextFactory.java:126)
                                  at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:106)
                                  ... 5 more
                        Elapsed time = 5294 milliseconds
                        
                        
                        • 9. Re: JMS Remote Client  not able to connect
                          jw Newbie

                          AFAIK you have to specify "-Djboss.bind.address=0.0.0.0" if you want to connect from 'not the localhost'.

                          • 10. Re: JMS Remote Client  not able to connect
                            jw Newbie

                            Did you found the solution? I ran into the same problem: Can connect from localhost (specifing localhost, local host's ip or local host's name), but not from a remote host.

                            I've modified the standalone-full.xml, but without success:

                             

                             

                            {code:xml}

                                    <subsystem xmlns="urn:jboss:domain:messaging:1.1">

                                        <hornetq-server>

                             

                             

                                            <acceptors>

                                                <netty-acceptor name="netty" socket-binding="messaging">

                                                    <param key="host" value="${jboss.bind.address:127.0.0.1}"/>

                                                </netty-acceptor>

                                                <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">

                                                    <param key="host" value="${jboss.bind.address:127.0.0.1}"/>

                                                    <param key="batch-delay" value="50"/>

                                                    <param key="direct-deliver" value="false"/>

                                                </netty-acceptor>

                                                <in-vm-acceptor name="in-vm" server-id="0"/>

                                            </acceptors>

                            {code}

                             

                             

                            Some more information: What I can see from the log files is that the connection factory returned by an JNDI lookup of jms/RemoteConnectionFactory connects always to the localhost while an JNDI lookup of an EJB finds the right host. This can be verfied by starting the AS7 on the 'server host' and 'client host'.

                            • 11. Re: JMS Remote Client  not able to connect
                              jw Newbie

                              workaround is to use nativ hornetq calls to obtain a session factory.

                               

                              insted of

                               

                              {code:java}

                              ctx.lookup("jms/RemoteConnectionFactory")

                              {code}

                               

                              you could use

                               

                              {code:java}

                               

                                      final Map<String, Object> p = new HashMap<String, Object>();

                                      TransportConfiguration tc;

                               

                               

                                      p.put(TransportConstants.HOST_PROP_NAME, "myHost");

                                      tc = new TransportConfiguration(NettyConnectorFactory.class.getName(), p);

                               

                                      HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.TOPIC_CF, tc);

                              {code}

                              1 of 1 people found this helpful
                              • 12. Re: JMS Remote Client  not able to connect
                                Noa Drach Novice

                                OK - this worked out for me

                                 

                                jw - thank you very much

                                 

                                - but the question is why doesn't it worked with JNDI - generally I preffer to work with something that i know and is supposed to be generic and not with another transport that i need to get familiar with - does any one have any idea?

                                • 13. Re: JMS Remote Client  not able to connect
                                  jw Newbie

                                  Currently I'm, using this configuration

                                   

                                  {code:xml}

                                  <connectors>

                                      <connector name="netty" socket-binding="messaging">

                                          <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                                          <param key="host" value="hostB"/>

                                      </connector>

                                  </connectors>

                                  {code}

                                   

                                  and the client does a simple JNDI lookup for jms/RemoteConnectionFactory.

                                   

                                  But I'm still not 100% happy because you can not configure localhost as host. Our customers have to manually set the right value for the host AS7 is running on each installation or when they move to another host.

                                   

                                  Similar discussion with some other workarounds (at the end): https://community.jboss.org/thread/196472