Setting up Glassfish Monitoring – handling connection problems

3 01 2012

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 ( Then VisualVM is lost, because following requests are sent to given IP (
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:


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!

About these ads



2 responses

10 02 2012
Remote use of VisualVM with Xming « Looks OK!

[...] post about problems with remote monitoring here is some more help needed when cases described in this post [...]

2 06 2012
Tab Sweep: CDI Tutorial, Vertical Clustering, Monitoring, Vorpal, SPARC T4, … « oracleidentitymanagement

[...] Budnik) • Glassfish – Vertical clustering with multiple domains (Alexandru Ersenie) • Setting up Glassfish Monitoring – handling connection problems (Jacek Milewski) • Screencast: Developing Discoverable XMPP Components with Vorpal (Chuk Munn [...]

Give Your feedback:

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: