Code: Select all
public static void main(String[] args) throws IOException, MalformedObjectNameException, ReflectionException, AttributeNotFoundException, InstanceNotFoundException, MBeanException
{
private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi";
System.out.println("Hello, Artemis!");
HashMap env = new HashMap();
String[] creds = {"artemis", "artemis"};
env.put(JMXConnector.CREDENTIALS, creds);
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), env);
MBeanServerConnection mBeanServer = connector.getMBeanServerConnection();
System.out.println("Connected to the server");
}
< /code>
Ausgabe: Wenn ich Activemq Artemis in einen Docker -Container mit den erforderlichen Ports verschlege .naming.CommunicationException [Root -Ausnahme ist java.rmi.connectioException: Fehler während der Einrichtung von JRMP -Verbindungen; Freiliegende JMX -Ports in Docker < /li>
Hinzufügen von Java -Argument in artemis.profile (-djava.rmi.server.hostname = localhost) < /li>
Enabled Connector-Element in Management.xml (
< /ul>