10 Replies Latest reply on Jun 11, 2019 11:54 AM by subrahmanyak

    JBOSS - Wildfly 7.1.6 - Connection refused error

    subrahmanyak

      Hi Team,

       

      I am using jboss 7.1.6 in domain mode. While trying to connect to jboss using remoting protocol, i get the error connection refused.

      remote://host_name:4447.

      In the log file I can see that jboss is listening on port 4447. Telnet works good from other machines through port 4447.

       

       

      Error I get is -

       

      WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection refused:

       

      And caused by section has this -

       

      Caused by: java.net.ConnectException: Connection refused: no further information

       

      Please help me on this issue.

       

      Thanks.

        • 1. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
          jaikiran

          Maybe a firewall on the target server is blocking the request?

          • 2. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
            subrahmanyak

            No, there is no firewall. Even I have tried executing directly on the server.

             

            Jboss that I have is 7.1.6 EAP. Not wildfly .. remote://localhost:4447 should work right? Is there different protocol?

            • 3. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
              jaikiran

              I don't fully remember what version of WildFly, JBoss EAP 7.1.x is based on. In one of the releases of WildFly, I think the remoting communication was now being done on the single HTTP port (8080) by default, instead of a remoting specific port. I don't know if that's playing a role here. You might want to check the ports that have been opened by JBoss EAP to verify if 4447 is indeed open.

              • 4. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
                subrahmanyak

                Do you mean Ihave to try with http protocol instead of remote? But I remember reading a documentation of jboss saying http is not encouraged to use. Please advice.

                 

                Meantime I ll try http protocol.

                • 5. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
                  jaikiran

                  subrahmanyak  wrote:

                   

                  Do you mean Ihave to try with http protocol instead of remote?

                  Yes

                   

                  subrahmanyak  wrote:

                   

                  But I remember reading a documentation of jboss saying http is not encouraged to use. Please advice.

                   

                   

                  HTTP port is actually recommended. See this article WildFly 11 Final is now available! · WildFly  for reasons (check the "Request oriented EJB/JNDI over HTTP" section)

                  • 6. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
                    subrahmanyak

                    Hi,

                     

                    I have tried with HTTP. I have different error coming up afterwards.

                     

                    javax.naming.CommunicationException: WFHTTP000005: Invalid response code 404 (full response ClientResponse{responseHeaders={content-length=[74], content-type=[text/html], date=[Tue, 11 Jun 2019 06:43:31 GMT]}, responseCode=404, status='', protocol=HTTP/2.0}) [Root exception is java.io.IOException: WFHTTP000005: Invalid response code 404 (full response ClientResponse{responseHeaders={content-length=[74], content-type=[text/html], date=[Tue, 11 Jun 2019 06:43:31 GMT]}, responseCode=404, status='', protocol=HTTP/2.0})]

                    at org.wildfly.httpclient.naming.HttpRootContext.performOperation(HttpRootContext.java:336)

                    at org.wildfly.httpclient.naming.HttpRootContext.lambda$processInvocation$0(HttpRootContext.java:257)

                    at org.wildfly.httpclient.naming.HttpRootContext.performWithRetry(HttpRootContext.java:173)

                    at org.wildfly.httpclient.naming.HttpRootContext.processInvocation(HttpRootContext.java:234)

                    at org.wildfly.httpclient.naming.HttpRootContext.processInvocation(HttpRootContext.java:228)

                    at org.wildfly.httpclient.naming.HttpRootContext.lookupNative(HttpRootContext.java:110)

                    at org.wildfly.naming.client.AbstractContext.lookup(AbstractContext.java:84)

                    at org.wildfly.naming.client.WildFlyRootContext.lookup(WildFlyRootContext.java:144)

                    at javax.naming.InitialContext.lookup(InitialContext.java:417)

                    at TestJBoss.main(TestJBoss.java:24)

                     

                    Thanks,

                    Subrahmanya

                    • 7. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
                      jaikiran

                      This now looks more like you lookup/invocation code using wrong JNDI names perhaps. You might want to add details about the application, including the client code as well as the JNDI names of the relevant EJBs, that are logged on the server side (in server.log).

                      • 8. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
                        subrahmanyak

                        Hi JaiKiran,

                         

                        My code is simple java code. It is not EJB. What I understand from your conversation is it needs to be a EJB code on the client side?

                         

                        Thanks,

                        Subrahmanya

                        • 9. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
                          jaikiran

                          subrahmanyak  wrote:

                           

                          Hi JaiKiran,

                           

                          My code is simple java code. It is not EJB. What I understand from your conversation is it needs to be a EJB code on the client side?

                          I was under the impression that you were trying to do a JNDI lookup from the client side (Java application) to the server side (WildFly). If that's not the case, then what exactly is the client code doing?

                          • 10. Re: JBOSS - Wildfly 7.1.6 - Connection refused error
                            subrahmanyak

                            Below is my code -

                             

                            import java.util.Properties;

                            import javax.naming.Context;

                            import javax.naming.InitialContext;

                            import javax.naming.NamingException;

                            import javax.sql.DataSource;

                             

                             

                             

                             

                            public class TestJboss {

                             

                             

                            /**

                            * @param args

                            */

                            public static void main(String[] args)

                            {

                            // TODO Auto-generated method stub

                             

                            Properties env = new Properties();

                            env.put(Context.INITIAL_CONTEXT_FACTORY,"org.wildfly.naming.client.WildFlyInitialContextFactory");

                            env.put(Context.PROVIDER_URL, "remote://localhost:4447");

                            env.put(Context.SECURITY_PRINCIPAL, "jboss");

                            env.put(Context.SECURITY_CREDENTIALS, "jbos1");

                             

                            DataSource ds= null;

                             

                            try {

                            Context remoteContext = new InitialContext(env);

                            Object lookup=remoteContext.lookup("jdbc/siperian-cmx_system-ds");

                            ds=(DataSource) lookup;

                            System.out.println("Data source lookup");

                            } catch (NamingException e) {

                            // TODO Auto-generated catch block

                            e.printStackTrace();

                            }

                             

                             

                             

                             

                             

                             

                            }

                            }

                             

                             

                            Error that I get from the code is -

                             

                             

                            Jun 11, 2019 9:22:21 PM org.wildfly.naming.client.Version <clinit>

                            INFO: WildFly Naming version 1.0.7.Final-redhat-1

                            Jun 11, 2019 9:22:21 PM org.wildfly.security.Version <clinit>

                            INFO: ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1

                            Jun 11, 2019 9:22:21 PM org.xnio.Xnio <clinit>

                            INFO: XNIO version 3.5.4.Final-redhat-1

                            Jun 11, 2019 9:22:21 PM org.xnio.nio.NioXnio <clinit>

                            INFO: XNIO NIO Implementation Version 3.5.4.Final-redhat-1

                            Jun 11, 2019 9:22:21 PM org.jboss.remoting3.EndpointImpl <clinit>

                            INFO: JBoss Remoting version 5.0.5.Final-redhat-1

                            javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection refused: no further information]

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentityForNaming(RemoteNamingProvider.java:110)

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentityForNaming(RemoteNamingProvider.java:53)

                            at org.wildfly.naming.client.NamingProvider.getPeerIdentityForNamingUsingRetry(NamingProvider.java:105)

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentityForNamingUsingRetry(RemoteNamingProvider.java:91)

                            at org.wildfly.naming.client.remote.RemoteContext.lambda$lookupNative$0(RemoteContext.java:189)

                            at org.wildfly.naming.client.NamingProvider.performExceptionAction(NamingProvider.java:222)

                            at org.wildfly.naming.client.remote.RemoteContext.performWithRetry(RemoteContext.java:100)

                            at org.wildfly.naming.client.remote.RemoteContext.lookupNative(RemoteContext.java:188)

                            at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:74)

                            at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:60)

                            at org.wildfly.naming.client.WildFlyRootContext.lookup(WildFlyRootContext.java:144)

                            at javax.naming.InitialContext.lookup(InitialContext.java:417)

                            at TestJboss.main(TestJboss.java:27)

                            Caused by: java.net.ConnectException: Connection refused: no further information

                            at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

                            at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)

                            at org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:327)

                            at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)

                            at ...asynchronous invocation...(Unknown Source)

                            at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:570)

                            at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:536)

                            at org.jboss.remoting3.ConnectionInfo$None.getConnection(ConnectionInfo.java:82)

                            at org.jboss.remoting3.ConnectionInfo.getConnection(ConnectionInfo.java:55)

                            at org.jboss.remoting3.EndpointImpl.doGetConnection(EndpointImpl.java:487)

                            at org.jboss.remoting3.EndpointImpl.getConnectedIdentity(EndpointImpl.java:433)

                            at org.jboss.remoting3.UncloseableEndpoint.getConnectedIdentity(UncloseableEndpoint.java:51)

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.getFuturePeerIdentityPrivileged(RemoteNamingProvider.java:151)

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.lambda$getFuturePeerIdentity$0(RemoteNamingProvider.java:138)

                            at java.security.AccessController.doPrivileged(Native Method)

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.getFuturePeerIdentity(RemoteNamingProvider.java:138)

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentity(RemoteNamingProvider.java:126)

                            at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentityForNaming(RemoteNamingProvider.java:106)

                            ... 12 more

                             

                             

                            Thanks,

                            Subrahmanya