10 Replies Latest reply on Apr 22, 2004 10:57 PM by poorboy

    Remote server connection problem

    poorboy

      Hi,

      I've got an app that was working just fine on the local machine. It's JBoss 3.2.3 + Tomcat 4.1.29 with PostgreSQL 7.4 database for storage. The client app is loaded via WebStart from a JSP, with JNDI settings coming in through properties set in the JNLP file.

      My problem is that when located on a remote server, it doesn't work. :( It appears to be either at authentication time or at EJB creation time (first EJB create == first authentication, I think?) it still tries to talk to local host. I get a ConnectException - a receive timeout connecting to 127.0.0.1. I've told it to talk to 192.168.0.10 (the server) in the java.naming.provider.url property, and indeed the name lookups seem to work, so what am I missing that would cause it to try to connect to localhost?

      Thanks.

        • 1. Re: Remote server connection problem
          poorboy

          Small correction - should be "connection refused" not a time out. Would be nice to make these forums editable...

          • 2. Re: Remote server connection problem
            raja05

            have u enabled remote connections to be contacted .
            i mean xhost +

            • 3. Re: Remote server connection problem

              Which OS do you use ? If you use redhat, check the host table.

              • 4. Re: Remote server connection problem
                poorboy

                It's not done through a remote X session, but rather through the RMI mechanism. The client app runs on client machine and sends/receives messages to the server app.

                • 5. Re: Remote server connection problem
                  poorboy

                  I'm using Mandrake Linux on the client, and Adamantix on the server. All hosts resolve properly on all machines. The same error happens with a Windows client too.

                  • 6. Re: Remote server connection problem
                    raja05

                    Can you just ping from the client machine to the server? Are u able to get a response.

                    • 7. Re: Remote server connection problem

                      Does the client software work if you install it on the client (not using JNLP) ?

                      • 8. Re: Remote server connection problem
                        poorboy

                        Yes, networking is fine - pings and things work as per normal. The app behaves equally badly from the command line.


                        java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
                        java.net.ConnectException: Connection refused
                        at com.freedomwigs.client.gui.app.LoginScreen.manageException(LoginScreen.java:96)
                        at com.freedomwigs.client.gui.app.LoginScreen.authenticateAgainstServer(LoginScreen.java:179)
                        at com.freedomwigs.client.gui.app.LoginScreen.doLogin(LoginScreen.java:156)
                        at com.freedomwigs.client.gui.app.LoginScreen.access$0(LoginScreen.java:149)
                        at com.freedomwigs.client.gui.app.LoginScreen$1.actionPerformed(LoginScreen.java:198)

                        The doLogin method is ok, then calls authenticateAgainstServer which fails. It can lookup the LoginBeanHome interface but fails when creating the LoginBean EJB. The 127.0.0.1 is referring to the client machine.

                        • 9. Re: Remote server connection problem

                          I am a little bit confused. I think the authenticateAgainstServer is called cause you try to instantiate a Bean, right ?

                          Here how i set the properties:


                          Properties prop = new Properties();
                          prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                          prop.put(Context.PROVIDER_URL, "jnp://JBossServer:1099");
                          prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
                          ctx = new InitialContext(prop);


                          I have activated authentification, too. And it works well.

                          • 10. Re: Remote server connection problem
                            poorboy

                            I had been setting the properties through the JNLP, and then through the lib/jnpi.properties file for the command line test. I removed those, and tried a command line test using the example code you gave. The first time was a timeout, after I forgot to change the server name (oops) but after fixing that, the result was another connection refused from 127.0.0.1. This happened with both the HTTPS and JNP interfaces.

                            What I think is happening is that it's looking up the EJB, and the server is telling it to get it from 127.0.0.1, rather than from the server's local network address....

                            ... playing with it while replying ...

                            BINGO. :-D

                            While digging around looking for answers, I found that the server was in fact resolving itself to the external (nat'd www) IP address. This meant that the address used for this stuff couldn't get past the firewall. I noticed this while shutting down the server, it said the name wasn't bound. So as far as JBoss was concerned, it couldn't access 210.x.x.x, and it never knew about 192.168.0.10, so sending 127.0.0.1 was a perfectly resonably thing to do :-/ I'd actually fixed this yesterday while the server was up, but it didn't re-bind, so the fix didn't really get fixed until I restarted JBoss. Oops.

                            Thanks for the help folks.