How to Enable JMX

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Enable JMX

gagansnt
I would like to enable JMX on my Grizzly Webserver. How can I do it ?
I found following information on some other threads on this forum - But I can not find the Management class. Can somebody please point me where it is present(under which package) and How can I configure the JMX port or what is the default port ?

server.enableJMX(new Management() {

      public void registerComponent(Object bean, ObjectName oname, String type)
          throws Exception {
        Registry.getRegistry().registerComponent(bean, oname, type);
      }

      public void unregisterComponent(ObjectName oname) throws Exception {
        Registry.getRegistry().unregisterComponent(oname);
      }
    });
Reply | Threaded
Open this post in threaded view
|

Re: How to Enable JMX

Ryan Lubke-2
For 2.0, JMX works a bit differently.

See [1] for the basics.

As far as JMX ports, etc, please see [2].

[1] http://blogs.sun.com/rlubke/entry/grizzly_2_0_now_has
[2] http://download.oracle.com/javase/1.6.0/docs/guide/management/agent.html

On 4/4/11 8:49 AM, gagansnt wrote:

> I would like to enable JMX on my Grizzly Webserver. How can I do it ?
> I found following information on some other threads on this forum - But I
> can not find the Management class. Can somebody please point me where it is
> present(under which package) and How can I configure the JMX port or what is
> the default port ?
>
> server.enableJMX(new Management() {
>
>        public void registerComponent(Object bean, ObjectName oname, String
> type)
>            throws Exception {
>          Registry.getRegistry().registerComponent(bean, oname, type);
>        }
>
>        public void unregisterComponent(ObjectName oname) throws Exception {
>          Registry.getRegistry().unregisterComponent(oname);
>        }
>      });
>
> --
> View this message in context: http://grizzly.1045725.n5.nabble.com/How-to-Enable-JMX-tp4282104p4282104.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to Enable JMX

gagansnt
Hi Ryan

Your blog does not talk about any annotations that I need to add in my code. Is it enabled by default and I do not need to anything in code ?

My project is not a Maven project but I have included the gmbal-3.1.0-b001.jar file in my project. When I tried without adding anything in my code and just including the jar then I am unable to see the MBeans "com.sun.grizzly" mentioned by you on your blog.

If you could please elaborate a bit about what changes I need to make in code.

Thanks in advance.
Gagan
Reply | Threaded
Open this post in threaded view
|

Re: How to Enable JMX

Ryan Lubke-2
On 4/4/11 10:48 AM, gagansnt wrote:
> Hi Ryan
>
> Your blog does not talk about any annotations that I need to add in my code.
> Is it enabled by default and I do not need to anything in code ?

If you're interested in only seeing what Grizzly exposes by default,
then there
is nothing you need to add.

> My project is not a Maven project but I have included the
> gmbal-3.1.0-b001.jar file in my project. When I tried without adding
> anything in my code and just including the jar then I am unable to see the
> MBeans "com.sun.grizzly" mentioned by you on your blog.

The blog outdates our package name changes.  They should be
org.glassfish.grizzly (it
was com.glassfish.grizzly, but as of this afternoon, I've fixed that).

> If you could please elaborate a bit about what changes I need to make in
> code.


You need to enable JMX in the server configuration by calling (something
it seems
was missed in the blog)

HttpServer.getServerConfiguration().setJmxEnabled(true).

I'll be updating the blog entry as well as being working on including
this information
in the 2.0 documentation.


> Thanks in advance.
> Gagan
>
> --
> View this message in context: http://grizzly.1045725.n5.nabble.com/How-to-Enable-JMX-tp4282104p4282338.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to Enable JMX

gagansnt
Thanks Ryan, it is working now. Today's morning seems to be a good morning.

Gagan