Monday, 17 August 2015

Remote JMX Connection Issue

Recently I tried to remotely connect to Liferay 6.2 's tomcat bundle on JMX via JConsole and JVisualVM with no success. Both applications repeatedly unable to connect via rmi. This boggled me as this never happened to me if the same to be done on Windows or my OSX macbook.

The only difference this time is I have Centos 7 running on my macbook. Yes, Centos 7, trying to get my hands dirty back on Linux. Installing Centos 7 on Macbook is another story. It took me a few days of misery and frustration until LiveCD saved me. OK, enough about me.

So, as usual you would need to supply VM arguments as follow:

Tips: You can quickly kill the process that is listening to port 9999 with "fuser -k 9999/tcp" command.

Normally this is would suffice, but not this time.
Further tests to narrow down to possible root cause includes:

1. Telnet to port - OK
# telnet <host-ip> 9999

2. Run local JConsole and JVisualVM - OK (although unneccessary)

Tips: You may completely disable firewall in Centos 7 with "sudo systemctl disable firewall-d" or
open up specific port with "sudo firewall-cmd --zone=public --add-port=9999/tcp && sudo firewall-cmd --reload"

After exhaustively searching through google and stackoverflow finally I found a blog page that suggest additional argument. Ironically, the blog post entry has nothing to do with my problem, duhh...additionally I found this via a comment in stackoverflow entry.

So, the additional argument that make it work is
Feel me? yeah, how silly is that and I don't know why and how that works. So, help me god if anyone would generously want to explain.

Made the changes then, I fired JConsole/JVisualVM and it works!

I hope that helps some one outthere.

Happy Godek'king!!

FYI "Godek" slang means "hack" in Malay :)

No comments:

Post a Comment