5 Replies Latest reply on Apr 25, 2004 11:55 PM by Than Win

    jboss 3.2.3 remote client java.net.ConnectE xception: Connec

    Than Win Newbie

      Hi Everybody,

      My EJBs are OK when I run the test from same PC but when I run from different PC (Red Hat 9), Failed to connect. I've open the port 1099 and the service is running.

      Anybody please help me! Thanks in advance

      Than Win

      My environment:
      Red Hat 9
      jvm 1.4.2_03
      jboss 3.2.3/tomcat 5
      xdoclet 1.2
      junit 3.8.1
      mysql 4.0.16-standard

      My errors:
      (interfaces.NamingContext 1185) Failed to connect to 192.
      168.210.5:1099
      [junit] javax.naming.CommunicationException: Failed to connect to server 192
      .168.210.5:1099 [Root exception is javax.naming.ServiceUnavailableException: Fai
      led to connect to server 192.168.210.5:1099 [Root exception is java.net.ConnectE
      xception: Connection refused]]
      [junit] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
      :215)
      [junit] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:
      1181)
      [junit] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:51
      4)
      [junit] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:50
      7)
      [junit] at javax.naming.InitialContext.lookup(InitialContext.java:347)
      [junit] at bank.interfaces.BankFacadeUtil.lookupHome(BankFacadeUtil.java
      :22)
      [junit] at bank.interfaces.BankFacadeUtil.getHome(BankFacadeUtil.java:54
      )
      [junit] at bank.test.createTest.setUp(createTest.java:45)
      [junit] at junit.framework.TestCase.runBare(TestCase.java:125)
      [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
      [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
      [junit] at junit.framework.TestResult.run(TestResult.java:109)
      [junit] at junit.framework.TestCase.run(TestCase.java:118)
      [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
      [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
      [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
      run(JUnitTestRunner.java:289)
      [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
      main(JUnitTestRunner.java:523)
      [junit] Caused by: javax.naming.ServiceUnavailableException: Failed to conne
      ct to server 192.168.210.5:1099 [Root exception is java.net.ConnectException: Co
      nnection refused]
      [junit] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
      :190)
      [junit] ... 16 more
      [junit] Caused by: java.net.ConnectException: Connection refused
      [junit] at java.net.PlainSocketImpl.socketConnect(Native Method)
      [junit] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      [junit] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.jav
      a:171)
      [junit] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      [junit] at java.net.Socket.connect(Socket.java:452)
      [junit] at java.net.Socket.connect(Socket.java:402)
      [junit] at java.net.Socket.(Socket.java:309)
      [junit] at java.net.Socket.(Socket.java:211)
      [junit] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocke
      tFactory.java:69)
      [junit] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocke
      tFactory.java:62)
      [junit] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
      :186)
      [junit] ... 16 more
      [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 5.69 sec

        • 1. Re: jboss 3.2.3 remote client java.net.ConnectE xception: Co
          Jon Barnett Master

          Make sure that your Red Hat system has its iptables (or ipchains depending on how it has been set up) configuration such that it allows connection from external systems. Are you able to telnet to port 1099 on the server with JBoss running on it?

          • 2. Re: jboss 3.2.3 remote client java.net.ConnectE xception: Co
            Than Win Newbie

            Hi jonlee,

            Thanks for your prompt reply.

            jnp settings
            09:29:38,789 INFO [NamingService] Starting jnp server
            09:29:38,994 INFO [NamingService] Started jnpPort=1099, rmiPort=1098, backlog=5
            0, bindAddress=/127.0.0.1, Client SocketFactory=null, Server SocketFactory=org.j
            boss.net.sockets.DefaultSocketFactory@ad093076
            09:29:39,046 INFO [NamingService] Listening on port 1099

            Firewall Settings in iptables
            -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 1099 --syn -j ACCEPT
            -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 80 --syn -j ACCEPT

            jnp is running and port is opened but I couldn't telnet.

            Many Thanks!

            • 3. Re: jboss 3.2.3 remote client java.net.ConnectE xception: Co
              Jon Barnett Master

              It doesn't look like it is binding correctly to the interface. It should look like this:

              2004-04-24 13:25:06,734 INFO [org.jboss.naming.NamingService] Starting jnp server
              2004-04-24 13:25:06,886 INFO [org.jboss.naming.NamingService] Started jnpPort=1099, rmiPort=1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null,
              Server SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076
              2004-04-24 13:25:06,915 INFO [org.jboss.naming.NamingService] Listening on port 1099
              2004-04-24 13:25:06,925 INFO [org.jboss.naming.NamingService] Started jboss:service=Naming
              2004-04-24 13:25:06,925 INFO [org.jboss.naming.JNDIView] Started jboss:service=JNDIView

              Most likely the network configuration is not correctly configured for the Linux boxen. Make sure that the /etc/hosts is correctly configured - the server name should not be defined in the 127.0.0.1 line.

              Otherwise, if you cannot work out the correct network configuration for your boxen, you can resort to defining jboss.bind.address - look at JBOSS_HOME/server/default/conf/jboss-service.xml. However, that would be a last resort as incorrectly configuring the Linux networking usually has ramifications on most Java network operations as the JVM is reliant on the underlying OS layer.

              Hope that helps.

              • 4. Re: jboss 3.2.3 remote client java.net.ConnectE xception: Co
                Than Win Newbie

                Hi Jonlee,

                Thanks for your prompt reply. I changed jnp bind address in /jboss/server/default/conf/jboss-service.xml and host name in /etc/hosts. The telnet result changed but remote client still couldn't connect, same error.

                jnp settings
                09:51:09,622 INFO [NamingService] Starting jnp server
                09:51:10,564 INFO [NamingService] Started jnpPort=1099, rmiPort=1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076
                09:51:10,714 INFO [NamingService] Listening on port 1099

                /etc/hosts
                127.0.0.1 localhost.localdomain localhost

                telnet output
                Trying 192.168.210.5...
                Connected to 192.168.210.5.
                Escape character is '^]'.
                ?srjava.rmi.MarshalledObject|?>IhashlocBytest[BobjBytesq~xpP<?r[T?xp3?t"http://localhost.localdomain:8083/q~q~uq~??sr org.jnp.server.NamingServer_Stubxr?java.rmi.server.RemoteStub????xrjava.rmi.server.RemoteObject?
                a3xpw8
                192.168.210.5Jf$?xConnection closed by foreign host. UnicastRef2

                Many Thanks!

                • 5. Re: jboss 3.2.3 remote client java.net.ConnectE xception: Co
                  Than Win Newbie

                  Hi Jonlee,

                  EJBs are running on remote client!!!! I made a mistake that I changed bind addresses in web services, NamingService and JRMPInvoker to localhost(default is ${jboss.bind.address}) in attempt to solve JNDI problems. Unfortunately, that was not the case (I'll post that problems this forum). So EJBs are OK on server but not from remote client. Your reply gave me clues that the problem might be binding address. I changed bind addresses to default and it works.

                  Thanks a lot!
                  Than Win