tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: [OT] Inspecting JMX
Date Thu, 26 Jan 2012 21:06:58 GMT
Christopher Schultz wrote:
> Hash: SHA1
> André,
> On 1/26/12 3:30 PM, André Warnier wrote:
>> independently of anything else, you may want to have a look at
>> jmxsh
> Now that I have *something* working, I can experiment to see what
> other things work as well :)
>> It is interactive as well as scriptable. (If I, who do not
>> understand much about JMX and mbeans (or even java), managed to use
>> it with Tomcat and other stand-alone java applications, it means
>> that it is really simple).
> If you got lost in my original post and you managed to get JMX
> monitoring up and running, then I think you might be on to something,
> here.
I needed a simple scriptable tool at some point in the past, to force Tomcat (and other 
Java programs) to do a major GC from time to time, to get rid of some dangling native 
socket left open in an inaccessible (but not yet collected) java object.
I believe it was Chuck who pointed me to jmxsh originally.
I only used it further by curiosity, without really understanding what I was doing.
But I know one useful feature is that it allows one to browse interactively, to find the 
available JMX?/mbeans?.

Example : force (the JVM running) Tomcat to do a GC :

# gc_tomcat.jmxsh
# force the target JVM to do a GC, via the jmxsh shell.
# invoke as :
# java -jar jmxsh.jar gc_tomcat.jmxsh
# In the following command, replace the port number (-p)
#	by the port which has been specified in the parameter :
#	of the target Java JVM startup line
#	(and so on for -U and -P)
jmx_connect -h -p 8200 -U controlRole -P mypass
jmx_invoke -m java.lang:type=Memory gc

To get the interactive shell, use the command "java -jar jmxsh.jar".

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message