alexk
25-06-2009, 02:44
I am trying to access tomcat (5.5) managed JMX MBeans, using the 2-port RMI connector workaround as described in http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html
The environment is Win XP, Java 6 for both client and server.
When tomcat is started w/o JMX client authentication (-Dcom.sun.management.jmxremote), everything is fine.
With authentication (-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=...jmx remote.password -Dcom.sun.management.jmxremote.access.file=...jmxre mote.access), I can get a connection fine (whenever the credentials are correct), but there is no "Users" or "Catalina" domains on the other end!
I thought it was an issue with jconsole but another client has exhibited the same behavior, and then I tried a programmatic client (code below) with the exactly the same outcome...
What am I missing?
The client code is
public static void main(String[] args) throws Exception
{
final String host = "myhost";
final int port = 8184;
final int namingPort = 8183;
final String jmxUrl =
"service:jmx:rmi://" + host + ":" + port +
"/jndi/rmi://" + host + ":" + namingPort + "/server";
final JMXServiceURL url = new JMXServiceURL(jmxUrl);
Map<String,Object> env = new HashMap<String,Object>();
String[] credentials = new String[] { "user" , "pwd" };
env.put("jmx.remote.credentials", credentials);
JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
String[] domains = mbsc.getDomains();
//verify (e.g. print) domain names here
}
-Alex
The environment is Win XP, Java 6 for both client and server.
When tomcat is started w/o JMX client authentication (-Dcom.sun.management.jmxremote), everything is fine.
With authentication (-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=...jmx remote.password -Dcom.sun.management.jmxremote.access.file=...jmxre mote.access), I can get a connection fine (whenever the credentials are correct), but there is no "Users" or "Catalina" domains on the other end!
I thought it was an issue with jconsole but another client has exhibited the same behavior, and then I tried a programmatic client (code below) with the exactly the same outcome...
What am I missing?
The client code is
public static void main(String[] args) throws Exception
{
final String host = "myhost";
final int port = 8184;
final int namingPort = 8183;
final String jmxUrl =
"service:jmx:rmi://" + host + ":" + port +
"/jndi/rmi://" + host + ":" + namingPort + "/server";
final JMXServiceURL url = new JMXServiceURL(jmxUrl);
Map<String,Object> env = new HashMap<String,Object>();
String[] credentials = new String[] { "user" , "pwd" };
env.put("jmx.remote.credentials", credentials);
JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
String[] domains = mbsc.getDomains();
//verify (e.g. print) domain names here
}
-Alex