Tomcat 6, JMX and the dynamic port problem

前端 未结 2 1319
名媛妹妹
名媛妹妹 2020-12-05 20:24

after reading and trying a lot around, I have to ask if anyone has a solution for my problem.

I am trying to set up some Tomcats (V6) behind a firewall. This is no b

相关标签:
2条回答
  • 2020-12-05 20:59

    Problem maybe the second random port opened by java itself when enabling jmx monitoring. Starting from Java 7 this port can be set, too:

    -Dcom.sun.management.jmxremote.rmi.port=7091

    So in combination - same port can be used:

    -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.rmi.port=7091

    That was the solution for my problem. Once the port is set to a fixed number, it can be easily set in the firewall.

    0 讨论(0)
  • 2020-12-05 21:19

    The answer is putting -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx to the general JMX options.

    An example to automatically set the hostname:

    IP=`ifconfig eth0  | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'``;
    
    CATALINA_OPTS="-Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.ssl=false
    -Dcom.sun.management.jmxremote.authenticate=TRUE
    -Dcom.sun.management.jmxremote.password.file=$CATALINA_HOME/conf/jmxremote.password
    -Dcom.sun.management.jmxremote.access.file=$CATALINA_HOME/conf/jmxremote.access
    -Djava.rmi.server.hostname=$IP"
    
    0 讨论(0)
提交回复
热议问题