From 7e7f02f000a476e525c866dd8d7f5328ddd83b6b Mon Sep 17 00:00:00 2001
From: Chris Ridd <chris.ridd@forgerock.com>
Date: Mon, 02 Mar 2015 14:59:47 +0000
Subject: [PATCH] CR-5578 fix OPENDJ-821: org.opends.server.protocols.jmx.client-unknown

---
 opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/RmiConnector.java |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/RmiConnector.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/RmiConnector.java
index b14d48a..e4d3502 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/RmiConnector.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/RmiConnector.java
@@ -27,6 +27,7 @@
 package org.opends.server.protocols.jmx;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.rmi.RemoteException;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
@@ -76,13 +77,6 @@
    */
   private MBeanServer mbs;
 
-
-  /**
-   * the client address to connect to the common registry. Note that a
-   * remote client should use the correct IP address.
-   */
-  private String registryClientAddress = "0.0.0.0";
-
   /**
    * The associated JMX Connection Handler.
    */
@@ -198,6 +192,7 @@
    */
   private void startCommonRegistry() throws Exception
   {
+    final InetAddress listenAddress = jmxConnectionHandler.getListenAddress();
     int registryPort = jmxConnectionHandler.getListenPort();
 
     //
@@ -213,7 +208,7 @@
       // TODO Not yet implemented: If the host has several interfaces
       if (registry == null)
       {
-        rmiSsf = new OpendsRmiServerSocketFactory();
+        rmiSsf = new OpendsRmiServerSocketFactory(listenAddress);
         registry = LocateRegistry.createRegistry(registryPort, null, rmiSsf);
       }
     }
@@ -367,7 +362,7 @@
       // Create the JMX Service URL
       String uri = "org.opends.server.protocols.jmx.client-unknown";
       String serviceUrl = "service:jmx:rmi:///jndi/rmi://"
-          + registryClientAddress + ":" + jmxConnectionHandler.getListenPort()
+          + jmxConnectionHandler.getListenAddress().getHostName() + ":" + jmxConnectionHandler.getListenPort()
           + "/" + uri;
       JMXServiceURL url = new JMXServiceURL(serviceUrl);
 

--
Gitblit v1.10.0