3

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
Biscuit128
  • 5,218
  • 22
  • 89
  • 149
  • is your jboss server behind a firewall? also, i assume it's a typo, but your first line is missing the closing quote. – jtahlborn Aug 04 '14 at 17:40
  • Sorry the quote was a copy paste error, my server is behind a firewall. Maybe the port didn't open correctly – Biscuit128 Aug 04 '14 at 17:44

2 Answers2

5

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

jtahlborn
  • 52,909
  • 5
  • 76
  • 118
  • ahhh i was so excited thinking this might be the correct answer but i still get the same error message - it must be a firewall issue for me – Biscuit128 Aug 04 '14 at 18:46
  • @Biscuit128 - there may be _additional_ firewall issues, but this is also a requirement to get it working. it presumes, of course, that your server is running on jdk 7u4 or later. – jtahlborn Aug 04 '14 at 19:00
  • @Biscuit128 - is this a linux box, and does the "hostname" of the box resolve to the "127.0.0.1"? – jtahlborn Aug 04 '14 at 19:12
  • the hostname resolves to the alias i named it - secondstory1d and yes it is fedora 20 and it is a box running locally on my network – Biscuit128 Aug 04 '14 at 19:15
  • @Biscuit128 - what does 'hostname -i' output? – jtahlborn Aug 04 '14 at 19:20
  • 192.168.0.14 - the static address i assign on my network for it – Biscuit128 Aug 04 '14 at 19:26
  • @Biscuit128 - maybe it's an ipv6 thing. your netstat output indicates it's listening on ipv6. possibly something else doesn't like that? if you don't need ipv6 support, what happens if you add "-Djava.net.preferIPv4Stack=true" to your jvm args? – jtahlborn Aug 04 '14 at 19:30
  • I already have it in there - JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true" – Biscuit128 Aug 04 '14 at 19:34
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58639/discussion-between-biscuit128-and-jtahlborn). – Biscuit128 Aug 04 '14 at 19:34
  • @Biscuit128 - hmm, that's weird then, that it would be binding to a tcp6 addr. one last shot, does `hostname -I' output anything interesting? – jtahlborn Aug 04 '14 at 20:40
  • nope , same ip is displayed just an additional (what appears to be ) mac address – Biscuit128 Aug 05 '14 at 09:56
0

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

Víctor Oriol
  • 492
  • 4
  • 15