I configured Apache Tomcat 8 using this tutorial https://tomcat.apache.org/tomcat-7.0-doc/monitoring.html and I generated SSL certificate.
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://10.16.70.161:9999/jmxrmi");
HashMap environment = new HashMap();
String[] credentials = new String[]
{
"user", "passw"
};
environment.put(JMXConnector.CREDENTIALS, credentials);
JMXConnector jmxc = JMXConnectorFactory.connect(url, environment);
MBeanServerConnection server = jmxc.getMBeanServerConnection();
Set<ObjectName> s2 = server.queryNames(new ObjectName("Catalina:type=Server,*"), null);
for (ObjectName obj : s2)
{
ObjectName objname = new ObjectName(obj.getCanonicalName());
System.out.println("serverInfo " + server.getAttribute(objname, "serverInfo"));
System.out.println("address " + server.getAttribute(objname, "address"));
System.out.println("stateName " + server.getAttribute(objname, "stateName"));
}
How I need to extend this JMX client in order to use it with SSL certificate? I can't find any good example on Internet.