3 Replies Latest reply on Jan 6, 2005 12:49 PM by dminnigerode

    Connecting to an EJb on a remote server

    Matthew Planchant Newbie

      I am trying to connect my GUi application to an EJB but I am encountering thr following exception:

      javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
       java.net.ConnectException: Connection refused: connect
      


      I have no idea where the 127.0.0.1 is coming from here.

      Any suggestions where I am going wrong?

        • 1. Re: Connecting to an EJb on a remote server
          Darran Lofthouse Master

          It looks like your remote machine might be running Linux?

          If so the /etc/hosts probably needs updating to contain the IP address of the machine.

          • 2. Re: Connecting to an EJb on a remote server
            Matthew Planchant Newbie

            Going from

            127.0.0.1 myserver localhost.localdomain localhost
            X.X.X.X myserver
            


            to

            127.0.0.1 localhost.localdomain localhost
            X.X.X.X myserver
            


            Seems to have sortyed the problem.

            Cheers.

            • 3. Re: Connecting to an EJb on a remote server
              dminnigerode Newbie

              Found this a javalobby.

              At 6:28 PM on Apr 1, 2003, Nils Holgersson wrote:



              Re: Communication Exception Jboss and some firewall info
              Hmmm, I'm fooling myself here. That didn't do the trick. But THIS did:

              In the /etc/hosts of the server machine, there was a mapping:
              127.0.0.1 localhost server.host.name

              As Jboss startet, it resolved server.host.name to 127.0.0.1. I put server.host.name in a DNS instead, where it should be. Alternatively you could write:

              127.0.0.1 localhost server.host.name
              1.2.3.4 server.host.name

              Then I had problem to get the client run both inside och outside of my NAT firewall. This because the RMI-stub sent by Jboss contained the local IP-address of server.host.name.

              By adding the JAVA_OPTS

              -Djava.rmi.server.hostname=server.host.name

              to the Jboss startup script run.sh, this was fixed as well. Now the RMI-stub delivered by jboss stated "server.host.name" and not an resolved IP address.