JMX and Tomcat
This is a question that is asked fairly often on the web, but I have yet to find a good answer anywhere.
How do I establish a connection between a Java application and the MBeanServer on a remote Tomcat server?
With Weblogic you use this:
String url ="t3://" + host +":" + port;
Environment env =new Environment();
env.setProviderUrl(url);
env.setSecurityPrincipal(username);
env.setSecurityCredentials(password);
Context ctx = env.getInitialContext();
MBeanHome localHome = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
With WebSphere you do this:
Properties props =new Properties();
props.setProperty(AdminClient.CONNECTOR_HOST, host);
props.setProperty(AdminClient.CONNECTOR_PORT, port);
props.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED,"true");
props.setProperty(AdminClient.USERNAME, username);
props.setProperty(AdminClient.PASSWORD, password);
AdminClient client = AdminClientFactory.createAdminClient(props);
I'm looking for similar code for Tomcat.
Thanks

