Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3325

Fix the handling of BindAddress and Host in org.jboss.web.WebService

XMLWordPrintable

      http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingJBossBehindAFirewall mentions the parameter "java.rmi.server.hostname" to set if the external host name differs from the local host (e.g. server machine is behind a firewall)
      But org.jboss.web.WebService doesn'r recognize this parameter:

      String hostname = server.getBindAddress(); // this always returns something, at least "0.0.0.0"!

      // If not user specified hostname given, then try to determine what it should be
      if (hostname == null) //this branch is never executed!
      {
      // First look for the rmi server name
      try

      { hostname = System.getProperty("java.rmi.server.hostname"); // this parameter is not recognized as this branch is never executed }

      catch (SecurityException e)

      { // ignore, but don't be silent ThrowableHandler.addWarning(e); }

      // else use the localhost name
      if (hostname == null)
      {
      try

      { hostname = InetAddress.getLocalHost().getHostName(); }

      catch (IOException e)

      { log.error("Failed to get localhost name; ignoring", e); }

      }

      if (hostname != null)

      { setHost(hostname); }

      }
      // Host must be set to continue (either by user or detection)
      String address = getHost();
      if (address == null)
      throw new MissingAttributeException("Host");

      // Set the rmi codebase if it is not already set
      String codebase = System.getProperty("java.rmi.server.codebase");
      if (codebase == null)

      { address = ServerConfigUtil.fixRemoteAddress(address); codebase = "http://" + address + ":" + getPort() + "/"; System.setProperty("java.rmi.server.codebase", codebase); }

      log.info("Using RMI server codebase: " + codebase);

      So the resulting problem is that codebase contains an address which is not reachable from the other side of firewall because "java.rmi.server.hostname" is not recognized (same for "-Djava.rmi.server.useLocalHostname=false" )

      Example:
      JBoss started with parameter set "-Djava.rmi.server.hostname=as2.subdomain1.subdomain2.test.com"
      but (thanks to rmi logging) the proxy objects on client side have codebase set to "http://as2:<port>" and not to "http://as2.subdomain1.subdomain2.test.com:<port>" as expected.

      JBoss 4 runs on a linux machine
      hostname --> "as2"
      hostname -f --> "as2.subdomain1.subdomain2.test.com"

              dandread1@redhat.com Dimitrios Andreadis
              rschroeder_jira Robert Schröder (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: