8 Replies Latest reply on Jul 29, 2014 3:08 PM by jonathasjose

    Could not connect to app server for remote client [Failed to connect to any server.]

    sachin.dhingra

      I have a client application which it needs to access the connection factory, topic & queue on my JBOSS EAP 6.1.0 application server which is on different box.

       

      In my client code when i use the providerURL as "remote://<box-name>:4447" it is giving below error:

      javax.naming.NamingException: Failed to connect to any server. Servers tried: [remote://<box-name>:4447]
          at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:213)
          at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:144)
          at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:125)
          at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:241)
          at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
          at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
          at javax.naming.InitialContext.lookup(Unknown Source)
      
      
      
      

       

      But when I moved my client code to the box where the JBOSS server is installed and changed the providerURL as "remote://localhost:4447", then it worked fine.

       

      Client code has below settings:

      InitialContextFactory=org.jboss.naming.remote.client.InitialContextFactory
      ProviderURL=remote://<Box-name>:4447
      
      

       

      I am not sure what else to be changed.

       

      Attached is the standalone.xml file.

       

      Any help is appreciated.

        • 1. Re: Could not connect to app server for remote client [Failed to connect to any server.]
          sachin.dhingra

          I have updated my standalone.xml file as:

               1. Added new interface "any" and change the "public" interface to use the IP address of the box

          <interface name="public">
                      <inet-address value="${jboss.bind.address:10.0.10.176}"/>
                  </interface>
                  <interface name="unsecure">
                      <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
                  </interface>
                  <interface name="any">
                      <any-address/>
                  </interface>
          

               2. Changed the "socket-binding-group"  to use the default-interface="any" as shown below but socket-binding name="messaging" &  socket-binding name="remoting" as public interface.

          <socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">
                  <socket-binding name="management-native" port="${jboss.management.native.port:9999}"/>
                  <socket-binding name="management-http" port="${jboss.management.http.port:9990}"/>
                  <socket-binding name="management-https" port="${jboss.management.https.port:9443}"/>
                  <socket-binding name="ajp" port="8009"/>
                  <socket-binding name="http" port="8080"/>
                  <socket-binding name="https" port="8443"/>
                  <socket-binding name="jacorb" interface="unsecure" port="3528"/>
                  <socket-binding name="jacorb-ssl" interface="unsecure" port="3529"/>
                  <socket-binding name="messaging" interface="public" port="5445"/>
                  <socket-binding name="messaging-group" port="0" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:9876}"/>
                  <socket-binding name="messaging-throughput" port="5455"/>
                  <socket-binding name="remoting" interface="public" port="4447"/>
                  <socket-binding name="txn-recovery-environment" port="4712"/>
                  <socket-binding name="txn-status-manager" port="4713"/>
                  <outbound-socket-binding name="mail-smtp">
                      <remote-destination host="<box-name>" port="25"/>
                  </outbound-socket-binding>
              </socket-binding-group>
          

           

          Now i could able to see below messages in log file:

          09:28:32,901 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on 10.0.10.176:4447
          

           

          I could able to do the client connection from same box by providing the below:

          ProviderURL=remote://<Box-name>:4447  
          
          

           

          But when i did the same thing from other box in same network, it is still giving me same error:

          javax.naming.NamingException: Failed to connect to any server. Servers tried: [remote://<box-name>:4447]  
              at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:213)  
              at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:144)  
              at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:125)  
              at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:241)  
              at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)  
              at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)  
              at javax.naming.InitialContext.lookup(Unknown Source) 
          
          

           

          Please suggest.

          • 2. Re: Re: Could not connect to app server for remote client [Failed to connect to any server.]
            sachin.dhingra

            I got the solution finally by removing security-realm="ApplicationRealm" from below line in standalone.xml file as in my client code i am not setting any user/password.

            <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/>
            
            2 of 2 people found this helpful
            • 3. Re: Re: Re: Could not connect to app server for remote client [Failed to connect to any server.]
              sachin.dhingra

              Here one weird observation is, I could able to access from remote client when client is on another windows box but not when my client is on AS/400 (Iseries) box.

               

              I am getting below exception:

              javax.naming.NamingException: Failed to connect to any server. Servers tried: [remote://<box-name>:4447]    
                  at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:213)    
                  at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:144)    
                  at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:125)    
                  at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:241)    
                  at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)    
                  at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)    
                  at javax.naming.InitialContext.lookup(Unknown Source)  
              
              

               

              Don't know what difference it makes when accessing from the Iseries box. Client code is just duplicated from windows box where it is working.

               

              My standalone.xml:

              <interfaces>
                      <interface name="management">
                          <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
                      </interface>
                      <interface name="public">
                          <inet-address value="${jboss.bind.address:10.0.10.176}"/>
                      </interface>
                      <interface name="unsecure">
                          <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
                      </interface>
                      <interface name="any">
                          <any-address/>
                      </interface>
                  </interfaces>
              
                  <socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">
                      <socket-binding name="management-native" port="${jboss.management.native.port:9999}"/>
                      <socket-binding name="management-http" port="${jboss.management.http.port:9990}"/>
                      <socket-binding name="management-https" port="${jboss.management.https.port:9443}"/>
                      <socket-binding name="ajp" port="8009"/>
                      <socket-binding name="http" port="8080"/>
                      <socket-binding name="https" interface="public" port="8443"/>
                      <socket-binding name="jacorb" interface="unsecure" port="3528"/>
                      <socket-binding name="jacorb-ssl" interface="unsecure" port="3529"/>
                      <socket-binding name="messaging" interface="public" port="5445"/>
                      <socket-binding name="messaging-group" port="0" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:9876}"/>
                      <socket-binding name="messaging-throughput" port="5455"/>
                      <socket-binding name="remoting" interface="public" port="4447"/>
                      <socket-binding name="txn-recovery-environment" port="4712"/>
                      <socket-binding name="txn-status-manager" port="4713"/>
                      <outbound-socket-binding name="mail-smtp">
                          <remote-destination host="localhost" port="25"/>
                      </outbound-socket-binding>
                  </socket-binding-group>
              

               

              Any help is appreciated.

              • 4. Re: Could not connect to app server for remote client [Failed to connect to any server.]
                wdfink

                If a client on a different box works for you  the server should be correct configured with the security settings and ports.

                Also the client code seems correct.

                The difference might be the AS/400 configuration, did you have firewalls or other network stuff in between?

                You might use telnet to check whether you can connect the port 4447 from the server machine.

                • 5. Re: Re: Could not connect to app server for remote client [Failed to connect to any server.]
                  sachin.dhingra

                  I have tried telnet to the box where JBOSS server is running using port 4447 from AS/400 box and it just flashed the screen and displayed message:

                  TELNET session ended.  Connection closed.

                   

                   

                  Also, in JBOSS server command window, I got the below message:

                  01:27:43,576 ERROR [org.jboss.remoting.remote.connection] (Remoting "<boxname>" read-1) JBREM000200: Remote connection failed: java.io.IOException: Received a
                  n invalid message length of -321281
                  

                   

                   

                  Even I tried telnet from another windows box where I could able to successfully connect using remote client, I got the similar message on JBOSS server console:

                  01:34:05,882 ERROR [org.jboss.remoting.remote.connection] (Remoting "<boxname>" read-1) JBREM000200: Remote connection failed: java.io.IOException: Received a
                  n invalid message length of 218762506
                  

                   

                   

                  This indicates to me that it has connected from AS/400 box also. Isn't it?

                   

                  I don't have any clue what's wrong now when client is on AS/400 box.

                  • 6. Re: Could not connect to app server for remote client [Failed to connect to any server.]
                    wdfink

                    Yes, that seems to be a successful connection to the server via 4447 port.

                    The only reason that prevent the client from a connection in this case is

                    - you use a different server name / ip address, or the name resolution is different

                    - the java process is blocked for outbound connections

                    - the java process select a wrong interface or IPv

                     

                    Is there a similar java option to set "java.net.preferIPv4Stack=true"

                    • 7. Re: Could not connect to app server for remote client [Failed to connect to any server.]
                      sachin.dhingra

                      Wolf,

                      For your suggestions I have below updates:

                       

                      You use a different server name / ip address, or the name resolution is different

                       

                           - I have used IP addess/fully qualified name but not luck.

                       

                      The java process is blocked for outbound connections

                       

                           - I don't think java process is blocked for outbound connections because i can access other servers from same client having different port.

                       

                      The java process select a wrong interface or IPv

                       

                           - I don't know what is this?

                       

                      Right now, my way of client invocation doesn't have 'java.net.preferIPv4Stack=true' but I also tried with this but still same results.

                      • 8. Re: Could not connect to app server for remote client [Failed to connect to any server.]
                        jonathasjose

                        Change as below:


                        <interface name="public"> 

                             <inet-address value="${jboss.bind.address:10.0.10.176}" />

                        </interface>

                        to

                        <interface name="public"> 

                             <inet-address value="10.0.10.176" />

                        </interface>


                         

                         

                         

                        worked for me!