fvaleri commented on code in PR #13720:
URL: https://github.com/apache/kafka/pull/13720#discussion_r1193803195


##########
tools/src/test/java/org/apache/kafka/tools/JmxToolTest.java:
##########
@@ -325,11 +327,15 @@ public void dateFormat() {
     }
 
     private static JMXConnectorServer startJmxAgent(int port) throws Exception 
{
+        // explicitly set the hostname returned to the the clients in the 
remote stub object
+        // when connecting to a multi-homed machine using RMI, the wrong 
address may be returned
+        // by the RMI registry to the client, causing the connection to the 
RMI server to timeout
+        System.setProperty("java.rmi.server.hostname", "localhost");
         LocateRegistry.createRegistry(port);
         Map<String, Object> env = new HashMap<>();
         env.put("com.sun.management.jmxremote.authenticate", "false");
         env.put("com.sun.management.jmxremote.ssl", "false");
-        JMXServiceURL url = new 
JMXServiceURL(String.format("service:jmx:rmi:///jndi/rmi://:%d/jmxrmi", port));
+        JMXServiceURL url = new JMXServiceURL(format(JMX_URL_TEMPLATE, port));

Review Comment:
   Sure, but I need to move that code inside beforeAll. I think it's better. 
Thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to