vamossagar12 commented on code in PR #13720: URL: https://github.com/apache/kafka/pull/13720#discussion_r1193755075
########## 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: minor nit: Is it possible to reuse the `jmxUrl` object created in `beforeAll`? The object passed in the `JMXServiceURL` seems to be the same as `jmxUrl`. -- 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