VisualVM problem connecting to monitor Glassfish
We had a issue getting VisualVM to connect to one of our Glassfish servers, in order for us to monitor it.
The problem was being caused by the server being behind our firewall, although the issue still existed after we had opened port 8686.
netstat -ano
command was showing us that the port was open, but no reasons as to why it wouldn’t connect:
tcp 0 0 :::8686 :::* LISTEN off (0.00/0/0)
Another one of our servers which is behind an older less secure firewall was connecting fine.
After much searching & head scratching, we found that we needed to add the following line to the JVM Option within Glassfish:
-Djava.rmi.server.hostname=YOUR_SERVERS_NAME
See this Oracle blog post for the reason why this is needed.
Summary:
If you are trying to access a server which is behind a NAT – you will most probably have to start your server with the option
-Djava.rmi.server.hostname=
so that the RMI stubs sent to the client contain the server’s public address allowing it to be reached by the clients from the outside.
One comment