3 Replies Latest reply on Jul 20, 2009 9:30 AM by doktora

    Remote JNDI lookup return local host IP

    doktora

      Hi,

      I have tomcat running on an external server (not on the same subnet) from JBoss 4.2.1 :

      Tomcat <--> [ExternalIP] FW <--> [InternalIP] JBoss

      JBoss is started with -b InternalIP

      Tomcat is configured with java.naming.provider.url=jnp://ExternalIP:1099

      What happens is that Tomcat connects to JBoss on 1099, then tries to get to InternalIP:1098, which is not visible from the Tomcat server (I assume JBoss tells it to connect to the IP on which it's listening - InternalIP).

      Eventually Tomcat gives up with:

      javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: <InternalIP>; nested exception is:
       java.net.ConnectException: Connection timed out]



      Any thoughts on how to configure this setup properly?
      Thanks
      dok

        • 1. Re: Remote JNDI lookup return local host IP
          doktora

          This can be partially fixed with setting this in jboss's run.conf as per http://www.jboss.org/community/wiki/UsingJBossBehindAFirewall:

          JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=<ExternalIP> -Djava.rmi.server.useLocalHostname=false"


          However, this breaks some MDB's (won't deploy, I suspect they try to get to ExternalIP and that's not resolvable from behind the firewall).

          Also, the client (Tomcat) still gets stuck while trying to bind to LocalIP:3873 which is the ejb3.deployer port -- from server/all/deploy/ejb3.deployer/META-INF/jboss-service.xml:
          <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>
          


          [/url]

          • 2. Re: Remote JNDI lookup return local host IP
            robertwilson

            I ran into this problem, I fixed it by binding to the hostname in DNS, then configuring the external and internal DNS servers to resolve this hostname to external and internal IP addresses respectively.

            • 3. Re: Remote JNDI lookup return local host IP (RESOLVED)
              doktora

              Resolved, after more reading of the above wiki page.

              The final piece of the puzzle was taking the first step in the "PooledInvoker" section, that is adding

              <attribute name="clientConnectAddress">webaddress.com</attribute>
               <attribute name="clientConnectPort">3873</attribute>


              to jboss/server/all/deploy/ejb3.deployer/META-INF/jboss-service.xml

              (I didn't change the http-invoker.sar).