Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
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 http://code.google.com/p/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 :
#       -Dcom.sun.management.jmxremote.port=xxxxx
#       of the target Java JVM startup line
#       (and so on for -U and -P)
jmx_connect -h 127.0.0.1 -p 8200 -U controlRole -P mypass
jmx_invoke -m java.lang:type=Memory gc
jmx_close

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to