JMX CONNECTIVITY USING PORT FORWARDING
We recently faced a performance issue in one of the weblogic applications we are supporting. We tried to debug the issue using OS tools and application logging. Unfortunately, we were not succeeded.
So, we thought of using Java profiling tool Java Mission Control (JMC) and flight recorder. When we tried to connect to JVM using JMC from our laptops, connection was failing. It was due to firewall restrictions.
You might already aware that in such scenarios we can use port forwarding to make remote port appear as local port. So, we have enabled port forwarding by changing putty session settings. Still, we are not able to connect to JVM from JMC. Came across this nice article after searching internet. In nutshell, if we want connect to remote JMX port using port forwarding technique, we need to do below two tasks:
- Enable jmxremote.rmi.port in addition to regular jmxremote.port.
- Forward jmxremote.port in addition to jmxremote.rmi.port.
As this is weblogic based application, we have added following lines in setDomainEnv.sh located in $DOMAIN_HOME/bin to enable jmx and rmi ports.
JAVA_OPTIONS=”${JAVA_OPTIONS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -XX:+UnlockCommercialFeatures -XX:+FlightRecorder”
export JAVA_OPTIONS
if [ “${SERVER_NAME}” = “AdminServer” ] ; then
JAVA_OPTIONS=”${JAVA_OPTIONS} -Dcom.sun.management.jmxremote.port=9001″
JAVA_OPTIONS=”${JAVA_OPTIONS} -Dcom.sun.management.jmxremote.rmi.port=9002 -Djava.rmi.server.hostname=localhost”
export JAVA_OPTIONS
elif [ “${SERVER_NAME}” = “wls_swb1” ] ; then
JAVA_OPTIONS=”${JAVA_OPTIONS} -Dcom.sun.management.jmxremote.port=9003″
JAVA_OPTIONS=”${JAVA_OPTIONS} -Dcom.sun.management.jmxremote.rmi.port=9004 -Djava.rmi.server.hostname=localhost”
export JAVA_OPTIONS
fi
export JAVA_OPTIONS
Forwarded both the ports by adding following settings in putty ssh session. Post that I am able to connect using JMC.
.png)
Comments
Post a Comment