4 Replies Latest reply on Mar 14, 2005 9:49 PM by jieshengz

    Connection Refused

    katsteve

      This topic has been posted several times, and I've tried many of the solutions (even though they don't say WHY they work) - but they haven't worked for me. EJB Client doing a lookup on a remote (nonLan) server hangs for 2 minutes, then gives Connection Refused exception.

      The network config has webserver(216.213.x.x)->router(69.18.x.x)->remote app server(10.1.201.x) [jboss3.2.2 on W2X]. My network guys insist the port is open,and JDBC connections to 1433 following the same route work fine.
      Webserver Clients within the LAN(10.1.201.x) work fine.

      I've tried -Djava.rmi.remote.server.hostname=69.18.x.x and 10.1.201.x.
      I've reassigned 1099, 1098, 4444 and 4445.
      I've seen references to an FAQ in the forum, but can't find it (since the links were all redone)
      I've tried client properties that put the provider URL at localhost, 69.18.x.x, and 10.1.201.x (which it can't find at all)

      Can anybody help? or at least explain?
      Do the network guys have to open a particular protocol on the router?

      Please help - I go to Production in a week!

      TIA
      Steve Terpening

        • 1. Re: Connection Refused
          katsteve

          A little more info...

          My Server startup log reads like this:

          13:33:23,484 INFO [NamingService] Starting jnp server
          13:33:23,656 INFO [NamingService] Started jnpPort=1099, rmiPort=1098, backlog=5
          0, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jbo
          ss.net.sockets.DefaultSocketFactory@ad093076
          13:33:23,671 INFO [NamingService] Listening on port 1099
          13:33:23,687 INFO [NamingService] Started jboss:service=Naming

          Even though my run.bat contains:

          set JAVA_OPTS "%JAVA_OPTS%" -Djava.rmi.server.hostname=10.1.201.x

          Shouldn't my bindAddress be something other than 0.0.0.0? Where does its value come from? Am I doing something stupid?

          Thanks,
          steve

          • 2. Re: Connection Refused
            katsteve

            Okay, I'm hoping that you guys are as confused as me. I promise that when I figure this out, I'll post an FAQ for it.

            Adrian and Scott have both mentioned an FAQ for the "rmi.remote.server.hostname trick", but I can't find any references in the FAQ/Wiki or forums.

            I'm thinking that somehow, the ejb lookup is searching for port 4444 on 10.1.201.x, not 69.18.x.x, which is causing the hang/connection timeout. The Exception trace shows that it goes through TCPEndPoint.newSocket() (see source and output below). And now I have ClassLoader problems on top of that. Sure hope someone can help me figure this one out.


            System.out.println("CONNECTION/LOOKUP TEST");

            Hashtable ht = new Hashtable();
            ht.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
            ht.put(Context.PROVIDER_URL,"jnp://69.18.x.x:1099");
            ht.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");

            InitialContext ctx = null;
            try { ctx = new InitialContext(ht); }
            catch (Exception e)
            { System.out.println("Initial Context failed...");
            e.printStackTrace();
            }

            try
            { Object homeObj = ctx.lookup("");
            System.out.println("GOT EJB HOME");
            }
            catch (Exception e)
            { System.out.println("EJB Lookup failed...");
            e.printStackTrace();
            }


            And here's the stack trace:

            CONNECTION/LOOKUP TEST
            EJB Lookup failed...
            javax.naming.CommunicationException. Root exception is java.rmi.ConnectExceptio
            n: Connection refused to host: 10.1.201.XX; nested exception is:
            java.net.ConnectException: Connection timed out: connect
            at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
            at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
            at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
            at sun.rmi.server.UnicastRef.invoke(Unknown Source)
            at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
            at javax.naming.InitialContext.lookup(InitialContext.java:354)
            at org.apache.jsp.connTest$jsp._jspService(connTest$jsp.java:87)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspSer
            vlet.java:202)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
            82)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
            icationFilterChain.java:247)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
            ilterChain.java:193)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
            alve.java:243)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
            alve.java:190)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
            .java:246)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
            2343)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
            ava:180)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
            rValve.java:170)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
            ava:170)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
            468)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
            ve.java:174)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
            r.java:1012)
            at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
            va:1107)
            at java.lang.Thread.run(Unknown Source)
            Caused by: java.net.ConnectException: Connection timed out: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(Unknown Source)
            at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
            at java.net.PlainSocketImpl.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.(Unknown Source)
            at java.net.Socket.(Unknown Source)
            at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
            ource)
            at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
            ource)
            ... 45 more


            Does any of this jump out at anyone? This is really an out-of-the-box installation.
            Thanks,
            Steve

            • 3. Re: Connection Refused
              richardyang

              I got the same problem like you.

              But I find the more information about it.
              holp some budy will help us

              first, It is working in version jboss 3.2.1 and fail after jboss3.2.2

              second , It is working in IP B class , butl fail exceed in A class
              it mean that if cline and server example like 192.168.X.X ,it work
              but fail in 192.X.X.X

              why? Is it a security setting? I can't resolve this problem for a long time.

              Please help me ~>_<~

              • 4. Re: Connection Refused