2 Replies Latest reply on Apr 12, 2004 9:32 AM by vng78

    RMI problems with more IP addresses


      It took a lot of time, but finally I solved a crazy problem.

      If the server PC has more than one network interface, with different IP addresses (e.g. an ADSL interface for internet, and an ethernet interface for a local area network), problems may arise accessing the server (Jboss or RMI) from outer world, because RMI re-routes the server activity to the LAN address while serving the requests coming from the WAN.

      The solution is to set the property java.rmi.server.hostname assigning as value the IP name or the IP address of the WAN interface.

      For RMI, you must put the following statement in the server application:

      System.setProperty("java.rmi.server.hostname",<WAN IP address>);
      before binding the implementation class in registry.

      e.g. System.setProperty("java.rmi.server.hostname","");
      or: System.setProperty("java.rmi.server.hostname","myhost.mydom.com");

      For Jboss, the server must be launched with the command:

      run.bat -Djava.rmi.server.hostname=<WAN IP address>

      Hope this will help somebody.
      Luigi Fonti

        • 1. Re: RMI problems with more IP addresses

          did you try to bind the server to a specific non-physical IP ( like localhost )?

          we would like to setup several servers bound to dedicated virtaul ips each, but didnt manage so far the problem with the RMI-Adaper.


          • 2. Re: RMI problems with more IP addresses

            Set the System's property in server application? You mean set it in any EJB class?

            I've tried putting -Djava.rmi.server.hostname inside run.bat, under JAVA_OPTS and it didn't work. Is it any different than your approach?

            Besides, is there a difference between setting the property in code and setting it in run.bat? Wouldn't it be part of the global system property either way?

            Can you please shed some light on this?