tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neven Cvetkovic <neven.cvetko...@gmail.com>
Subject Re: Application monitoring
Date Mon, 19 May 2014 07:23:11 GMT
On Sun, May 18, 2014 at 11:26 PM, Neven Cvetkovic <neven.cvetkovic@gmail.com
> wrote:

>
> > >> Which is "item 3"? I'd be happy to fix whatever is missing.
> > >>
> > >> - -chris
> > >
> > > Example Application Exposing Internals Using JMX
> > >
> > > at the bottom of the page goes nowhere. More accurately, it goes to
> > > a placeholder page.
> >
> > Aah. NevenCvetkovic added that link, not me, so I dunno what he was
> > expecting to put there.
> >
>
> Chris thanks for the reminder, I will fix the missing page with the
> example I wrote, back then.
>
> I thought I have published that already.
>
I've uploaded code examples and the JmxExample.war:
https://wiki.apache.org/tomcat/Example%20Application%20Exposing%20Internals%20Using%20JMX

So, just deploy JmxExample.war to your Tomcat instance, open up JMX console
through JVisualVM or JConsole, and find the MBean, e.g.
JmxExampleApp:type=Counter

You will see that the internal instance of MyCounter is exposed through
JMX, and you will be able to set the name, initial count, reset the
counter, etc...

The trick was to use @WebListener that registers the MBean instance with
your MBeanServer upon application deployment. Your MBean instance will wrap
around any of your application internals you would with to expose.

Hope that helps!

Cheers!
Neven

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message