MBeanServer.registerMBean(...) in init()
in the jboss examples I see no code like MBeanServer.registerMBean(...).
If I'll write a standard mbean, where should I write the above code.
> in the jboss examples I see no code like
JBoss uses its own service format to create MBeans.
> If I'll write a standard mbean, where should I write
> the above code.
Where ever the resource you want to manage is ready and instantiated, for example in the servlet's init() method as Adrian suggested.
More info on the JMX API: http://vig.pearsoned.com/store/product/1,3498,store-6781_isbn-0672322889,00.html
First of all, thanks for your responses.
Second, I wrote a new mbean one class called MyClass that implements an mbean interface, MyMBean.
I entered the registerMBean... code to the constructor of the class with (this, objectname);
I added a jboss-service.xml, and wrapped it all into sar file.
Now I get "Class does not expose a management interface" what am I doing wrong???
The naming convention for standard MBean interface is <class-name>MBean, so in the case of MyClass the interface name *must* be MyClassMBean.