[jboss-user] [Management, JMX/JBoss] - Re: persist & auto-restart mbean

cnsxxx09 do-not-reply at jboss.com
Fri Oct 27 07:01:50 EDT 2006


Thanks for the pointer ... I made some progress, I think.

Before I had my plain MBean registered and invokable.

Now, trying to use it as an XMBean,  I have some kind of MBean registered which is not my class, and it has no methods/parameters to invoke/change.
I had expected it to just be like a wrapper to my class ... instead it is an empty wrapper ...

Any idea what step I missed?

I'm not sure I understand how it should work but I am expecting the XMBean to inherit everything from my MBean.

Here is my code:
        work.MyClass mBean = new work.MyClass();
        ObjectName objectName = new ObjectName("mydomain.com:job=MyJob,id=" +
                System.identityHashCode(mBean));
        XMBean xmbean = new XMBean(mBean, XMBeanConstants.STANDARD_MBEAN);

        ModelMBeanInfo minfo = new ModelMBeanInfoSupport("work.MyClass",
                "Uninitialized XMBean", new ModelMBeanAttributeInfo[0],
                new ModelMBeanConstructorInfo[0], new ModelMBeanOperationInfo[0],
                new ModelMBeanNotificationInfo[0]);

minfo.getMBeanDescriptor().setField(ModelMBeanConstants.PERSIST_NAME, objectName);
        minfo.getMBeanDescriptor().setField(ModelMBeanConstants.PERSIST_POLICY, "OnUpdate");
        minfo.getMBeanDescriptor().setField(ModelMBeanConstants.PP_NEVER, "false");
        minfo.getMBeanDescriptor().setField(ModelMBeanConstants.PERSISTENCE_MANAGER, "org.jboss.mx.persistence.DelegatingPersistenceManager");

        xmbean.setModelMBeanInfo(minfo);

        server.registerMBean(xmbean, objectName);

        invokeStringMethod(objectName, "setAStringObject", myStringObject);

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981264#3981264

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981264



More information about the jboss-user mailing list