How to configure JMX on Apache Tomcat

http://server-demo-ec2.cloveretl.com/clover/docs/jmx-configuration.html

JMX configuration

Application's JMX MBeans aren't accessible outside of JVM by default. It needs some changes in application server configuration to make them accessible.

This section describes how to configure 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:

How to configure JMX on Apache Tomcat

Tomcat's JVM must be executed with these self-explanatory parameters:

  1. -Dcom.sun.management.jmxremote=true

  2. -Dcom.sun.management.jmxremote.port=8686

  3. -Dcom.sun.management.jmxremote.ssl=false

  4. -Dcom.sun.management.jmxremote.authenticate=false

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"

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

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

How to configure JMX on Glassfish

Go to Glasfish 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:

Glassfish JMX connector

Figure 13.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)

How to configure JMX on Websphere

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]

Websphere configuration

Figure 13.2. Websphere configuration


Websphere 6

URL for connecting to JMX server is:

service:jmx:rmi:///jndi/JMXConnector

Following system properties need to be set:

org.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB
java.naming.provider.url=corbaloc:iiop:[host]:[port]/WsnAdminNameService 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 2809, 2810,... 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 2810

You will also need to set on the classpath following jar files from Websphere home directory:

/runtimes/com.ibm.ws.admin.client_6.1.0.jar
/runtimes/runtimes/com.ibm.ws.webservices.thinclient_6.1.0.jar
/java/jre/lib/ibmorb.jar

Websphere 7

URL for connecting to JMX server is:

service:jmx:iiop://[host]:[port]/jndi/JMXConnector

where host is the host name you are connectiong to and port is RMI port number. If you have a default Websphere installation, the JNDI port number will likely be 2809, 2810, ... 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 2810

How to configure JMX on Websphere7

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]

Websphere7 configuration

Figure 13.3. Websphere7 configuration


URL for connecting to JMX server is:

service:jmx:iiop://[host]:[port]/jndi/JMXConnector

where host is the host name you are connectiong to and port is RMI port number. If you have a default Websphere installation, the JNDI port number will likely be 2809, 2810, ... 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 2810

You will also need to set on the classpath following jar files from Websphere home directory:

/runtimes/com.ibm.ws.admin.client_7.0.0.jar
/runtimes/com.ibm.ws.ejb.thinclient_7.0.0.jar
/runtimes/com.ibm.ws.orb_7.0.0.jar

Possible problems
  • 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

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值