Setting up Glassfish Monitoring – handling connection problems

On a production environment I came across few (mainly connection related) issues while trying to monitor glassfish application remotely with either JConsole or VisualVM. Tools does not differ in a connection method – problems were exactly the same and not caused by tools, but by glassfish setup, application statuses and firewall configuration.

Standard Settings Required

There is not very much of it. Just turn on Glassfish Monitoring using GUI. For HTTP Service and Web Container at least. LOW level is enough. Set it in: Configuration -> Monitoring.

Default configuration in Configuration -> Admin Service -> System is enough. You can take a look also in Application Server -> Monitor, if You like :)

Problem 1

One of the Glassfish applications in VisualVM is visible but its stats are not available (App #1), and the other application is not visible at all
It appears that this is some old app visible in Glassfish admin GUI, but not existing on the file system. Here is how it looks like in VisualVM:

VisualVM showing dead application
VisualVM Showing dead application

App cannot be analyzed and there is some info on the VisualVM troubleshooting page (at the bottom):

No Servlets Displayed In The Runtime Area Of GlassFish Web Application Tab
Description: There are no servlets displayed in the runtime are of GlassFish web application tab (see here)
Resolution: Only servlets with some statistics available are displayed. In order to generate statistics put some load on the web application.

It appeared that App #1 was an older version of an existing App #2 (that is was not visible because of it). Removing App #1 by Glassfish admin GUI helped to resolve this conflict, and App #2 (the current version showed up and was able to be monitored.

Problem 2

Problem connecting to the remote Glassfish instance
After setting up the Glassfish IP address and credentials the connection could not be established. I solved this issue by dedicated RMI configuration. It was necessary because of a NAT, I suppose. The result is that RMI receives packets from VisualVM, and then responses that it is listening on his local IP address (127.0.0.1). Then VisualVM is lost, because following requests are sent to given IP (127.0.0.1).
The solution is to set in a Glassfish his own external IP address, using GF admin GUI. There You have to set the JVM Parameter:

-Djava.rmi.server.hostname=Glassfish_Server_External_IP_Address

And it works! Helpful sources: source 1 and source 2.

(Theoretical) Problem 3

Maybe jstatd or firewall?
This source states that the jstatd (daemon responsible for RMI) has to be running in order to be able to connect to GF using RMI. I have two hosts with similar configuration, and to the one of them I was able to connect, the other one – not. both of them did not have jstatd running. As it turned out later this was not the problem (my problem was RMI IP described in Problem 2).

So info in this source may be outdated or maybe I’ve made some mistake in using it or it was simply not a case for me.

Firewall can surely be a cause of Your problem. If You know that traffic is blocked – nothing will help. Then I advice You to try setting up Monitoring tool locally on Glassfish Server and connect using Xming. This is also a good solution.

Do not hesitate to ask a question if You need more details!

Did I help you?
I manage this blog and share my knowledge for free sacrificing my time. If you appreciate it and find this information helpful, please consider making a donation in order to keep this page alive and improve quality

Donate Button with Credit Cards

Thank You!

2 thoughts on “Setting up Glassfish Monitoring – handling connection problems

Give Your feedback: