Biscuit128
Biscuit128

Reputation: 5408

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

Upvotes: 4

Views: 4843

Answers (2)

Víctor Oriol
Víctor Oriol

Reputation: 576

You need add the option:

-Dcom.sun.management.jmxremote.local.only=false

At restart, when you run "netstat" you can see that the port is not open only for localhost:

$ netstat -na | grep 9999 tcp6 0 0 :::9999 :::* LISTEN

Finally, you can validate with a telnet:

telnet 94.5.19.27 9999

If you could not connect is possible that you need to review your firewall, in linux:

firewall-cmd --permanent --add-port=9999/tcp

I hope that this help you

Upvotes: 0

jtahlborn
jtahlborn

Reputation: 53694

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/ .

Upvotes: 6

Related Questions