3 Replies Latest reply on Jan 20, 2002 10:00 AM by Åsmund Hjulstad

    Connection Refused with Trivial client on second machine

    Christina Clarke Newbie

      Hi.

      We are looking at JBoss 2.4.3 as a replacement for an existing development platform for several good reasons. We have only been able to get a basic example (Sun J2EE SavingsAccount example) running when all is deployed on one single machine. Records get written to the database (Interbase 6.01) fine from a BMP EJB. We have been not been able to get close to getting this to work if the client is moved to another machine.

      The error is:
      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

      To answer all the obvious questions:
      o Yes we can ping between the machines, both ways
      o Yes we can telnet into port 1099 on the target
      o Yes we can run a simple java url client and connect to it.
      o No, there is no firewall in between
      o Yes, the ejb deploys successfully
      o No the jndi.properties file does *not* say localhost, it references the correct hostname (and by the way, if we try to prepend a protocol definition e.g. jnp:// it does not work either remotely *or* locally)

      The example ejb-jar.xml with the jboss-2.4.3 download works fine (with obvious edits only) for the local client, although it does not seem to correspond to the DTD in the "Book" pdf download (page 109, fig 3.1). If we try to follow that we get all sorts of other errors.

      Here's the ejb-jar.xml that works on a local client..
      <?xml version="1.0"?>
      <ejb-jar>
      EJB Sun Savings Account Sample Application
      <enterprise-beans>

      <display-name>SavingsAccountBean</display-name>
      Test for JBoss Deployment
      <ejb-name>SavingsAccount</ejb-name>
      SavingsAccountHome
      SavingsAccount
      <ejb-class>SavingsAccountBean</ejb-class>
      <persistence-type>Bean</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False

      </enterprise-beans>
      </ejb-jar>

      Apologies for the length of this, but there seem to be very many inconsistencies between the documentation and the actual sample code and actual behavior, or maybe it is our eyes...

      Any advice, insights or ideas would be greatly appreciated...

      Thanks in advance for any help at all...

        • 1. Re: Connection Refused with Trivial client on second machine
          Åsmund Hjulstad Newbie



          I'm experiencing similar (identical?) problems. What could I be doing wrong?

          There is traffic between my client and the host. Looking at the packets, there is traffic from the server port 1099 to my machine. In the payload of one of the packets, I find the text "127.0.0.1". There is also mention of several class-names related to naming:
          org.jnp.server.NamingServer_Stub, java.rmi.server.RemoteStub and java.rmi.server.RemoteObject

          After this happens, I get a "connection refused to host 127.0.0.1"

          This leads me to the conclusion that there is an issue with the configuration of my server...

          But, the only configuration-file I'm able to locate
          (grep -r "127.0.0.1" * ; grep -r "localhost" *) is jndi.properties, with a line saying:

          # Do NOT uncomment this line as it causes in VM calls to # go over RMI!
          #java.naming.provider.url=localhost

          Am I missing something?

          • 2. Re: Connection Refused with Trivial client on second machine
            Adrian Brock Master

            Have a look in your host table.
            You will see something like

            127.0.0.1 localhost myhostname
            xxx.xxx.xxx.xxx myhostname

            remove the myhostname from 127.0.0.1

            Regards,
            Adrian

            • 3. Re: Connection Refused with Trivial client on second machine
              Åsmund Hjulstad Newbie

              > Have a look in your host table.
              > You will see something like
              >
              > 127.0.0.1 localhost myhostname
              > xxx.xxx.xxx.xxx myhostname
              >
              > remove the myhostname from 127.0.0.1

              Well, in my case, the problem was that the development server uses dynamic ip, and had a bogus hostname. But, I wouldn't have looked in that direction without your pointer.

              I think this might be a FAQ...

              Thanks,
              Åsmun.