Application's JMX MBeans aren't accessible outside of JVM by default. It needs some changes in an application server configuration to make JMX Beans accessible.
This section describes how to configure a JMX Connector for development and testing. Thus authentication may be disabled. For production deployment authentication should be enabled. Please refer further documentation to see how to achieve this. i.e. http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#auth
Configurations and possible problems:
Tomcat's JVM must be executed with these self-explanatory parameters:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=8686
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=your.server.domain (necessary only for remote JMX connections)
On UNIX like OS set environment variable CATALINA_OPTS i.e. like this:
export CATALINA_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=8686 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=your.server.domain.com"
File TOMCAT_HOME/bin/setenv.sh (if it does not exist, you may create it) or TOMCAT_HOME/bin/catalina.sh
On Windows it might be tricky, that each parameter must be set separately:
set CATALINA_OPTS=-Dcom.sun.management.jmxremote=true set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.port=8686 set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.ssl=false set CATALINA_OPTS=%CATALINA_OPTS% -Djava.rmi.server.hostname=your.server.domain
File TOMCAT_HOME/bin/setenv.bat (if it does not exist, you may create it) or TOMCAT_HOME/bin/catalina.bat
With these values, you can use URL
service:jmx:rmi:///jndi/rmi://localhost:8686/jmxrmi
for connection to JMX server of JVM. No user/password is needed
Go to Glassfish admin console (by default accessible on http://localhost:4848 with admin/adminadmin as user/password)
Go to section "Configuration" > "Admin Service" > "system" and set attributes like this:
Figure 25.1. Glassfish JMX connector
With these values, you can use URL
service:jmx:rmi:///jndi/rmi://localhost:8686/jmxrmi
for connection to JMX server of JVM.
Use admin/adminadmin as user/password. (admin/adminadmin are default glassfish values)
WebSphere does not require any special configuration, but the clover MBean is registered with the name that depends on application server configuration:
server.api.jmx:cell=[cellName],name=cloverServerJmxMBean,node=[nodeName],process=[instanceName]
Figure 25.2. WebSphere configuration
URL for connecting to JMX server is:
service:jmx:iiop://[host]:[port]/jndi/JMXConnector
where host is the host name you are connecting to and port is RMI port number. If you have a default WebSphere installation, the JNDI port number will likely be 9100, depending on how many servers there are installed on one system and the specific one you want to connect to. To be sure, when starting WebSphere, check the logs, as it will dump a line like
0000000a RMIConnectorC A ADMC0026I: The RMI Connector is available at port 9100
You will also need to set on the classpath following jar files from WebSphere home directory:
runtimes/com.ibm.ws.admin.client_8.5.0.jar |
runtimes/com.ibm.ws.ejb.thinclient_8.5.0.jar |
runtimes/com.ibm.ws.orb_8.5.0.jar |
Default JMX mBean server uses RMI as a transport protocol.
Sometimes RMI cannot connect remotely when one of peers uses Java
version 1.6. Solution is quite easy, just set these two system
properties: -Djava.rmi.server.hostname=[hostname or IP
address] -Djava.net.preferIPv4Stack=true