Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to remote JBoss with JMX behind a firewall

I have added the following properties to my JBOSS EAP 6.2 server;

   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9999"
   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
   JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=94.5.19.27"

And have restarted jboss. When I try to connect to the instance using the following in JMX string in JVisualVM ( 94.5.19.27:9999 ) I get the following error message

enter image description here

Does anyone know which other configurations I might need to pass?

Thanks

edit if it were a firewall issue - would this return as follows;

[secondstory_dev@secondstory1d log]$ netstat -na | grep 9999
tcp6       0      0 127.0.0.1:9999          :::*                    LISTEN
like image 482
Biscuit128 Avatar asked Oct 14 '25 09:10

Biscuit128


1 Answers

There's a trick to getting rmi working behind a firewall. rmi uses two ports, and if you don't specify both ports, it doesn't work through a firewall. the nice part is that you can use the same port for both ports. the annoying part is that this is not the default functionality. even worse, until jdk 7, there was no way to configure jmx to do this using the command line. assuming you are running on jdk 7+, you need to add this argument:

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

More details here http://realjenius.com/2012/11/21/java7-jmx-tunneling-freedom/ .

like image 83
jtahlborn Avatar answered Oct 16 '25 21:10

jtahlborn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!