-
1. Re: Can't get MBean to participate in Service Life Cycle
juhalindfors Jul 11, 2003 11:41 AM (in response to wargun02)Is your create, start, stop, destroy methods invoked by the container? You should see a message in the logs in the form of
[INFO] servicename created
[INFO] servicename started -
2. Re: Can't get MBean to participate in Service Life Cycle
wargun02 Jul 12, 2003 2:34 AM (in response to wargun02)No, unfortunately not. The only [INFO] messages related is:
INFO [SARDeployer] nested deployment: file:/usr/java/jboss-3.2.1/server/MBeanTest/deploy/xxx.sar/xxx.jar
INFO [MainDeployer] Deployed package: file:/usr/java/jboss-3.2.1/server/MBeanTest/deploy/xxx.sar/ -
3. Re: Can't get MBean to participate in Service Life Cycle
juhalindfors Jul 12, 2003 5:56 AM (in response to wargun02)also make sure you expose the methods in your MBeanInfo
-
4. Re: Can't get MBean to participate in Service Life Cycle
wargun02 Jul 12, 2003 9:49 AM (in response to wargun02)Yes, I have declared an array of MBeanOpertionInfo , which was set to an MBeanInfo object when return it in getMBeanInfo(). However, I've put a null in the MBeanNotification parameter.
-
5. Re: Can't get MBean to participate in Service Life Cycle
ioparra Jul 16, 2003 10:55 PM (in response to wargun02)Does your managedBean extend the ServiceMBeanSupport class?
-Ivan -
6. Re: Can't get MBean to participate in Service Life Cycle
wargun02 Jul 17, 2003 8:53 PM (in response to wargun02)Hi people,
After stumbling too many times, I've found the easiest solution to my own problem. The very truth, we don't even need to depend on Sun's JMX implementation of interfaces such as javax.management.ModelMBean or even the javax.management.DynamicMBean, etc...All we need is just two classes to get things working.
I have two .java files attached as an example. I've written an interface "JBossServiceStarterMBean.java" which encapsulates all the methods necessary and they are:
:- public void init();
:- public void create() throws Exception;
:- public void start() throws Exception;
:- public void stop();
:- public void destroy();
Another class is the implementation class "JBossServiceStarter.java", which extends "org.jboss.system.ServiceMBeanSupport" and implements "JBossServiceStarterMBean". This class will implement all the methods declared in JbossServiceStarterMBean. Once this pattern is established, you could define your service in tags within any xxx-service.xml and the mbean class. Here's an example:
<!DOCTYPE server>
** Do take note that the accompanying jars defined as an "archives" attribute to must be separated with "," WITHOUT ANY SPACES IN BETWEEN. If its "a.jar, b.jar", the jars will not be loaded properly.
The above mentioned are just guidelines which I've discovered. It may not be the best way to do things but...any comments are welcome. Do pardon my ignorance....
I hope this helps...
Regards,
Max -
7. Re: Can't get MBean to participate in Service Life Cycle
ioparra Jul 18, 2003 2:20 PM (in response to wargun02)Hmm. When I've extended the ServiceMBeanSupport, I simply override startService/endService. Everything should be taken care of for you. If you override start/stop/init, your not allowing the life cycle to proceed.
Try calling super.start() in your start method.
-Ivan -
8. Re: Can't get MBean to participate in Service Life Cycle
wargun02 Jul 21, 2003 1:11 AM (in response to wargun02)Aman...
-
9. Re: Can't get MBean to participate in Service Life Cycle
sseifodd Oct 1, 2003 2:36 PM (in response to wargun02)Hi,
Thanks for the detailed example. I followed it and am getting the following error:
(org.jboss.deployment.DeploymentException: Class does not expose a management interface: com.harri
s.has.configservice.jmx.ResyncMbeanImpl; - nested throwable: (javax.management.NotCompliantMBeanException)
Is there any other interface I need to implement.
I am using jboss 3.2.1/tomcat 4.1.24.
Your advise in this matter is highly appreciated.
Thanks,
Sufie -
10. Re: Can't get MBean to participate in Service Life Cycle
juha Oct 1, 2003 5:18 PM (in response to wargun02)Your MBean needs to implement an MBean interface:
class MyClass implements MyClassMBean
-- Juha -
11. Re: Can't get MBean to participate in Service Life Cycle
sseifodd Oct 2, 2003 11:08 AM (in response to wargun02)I believe I am doing that.
Attached are my two files and my service.xml file:
Any idea what is wrong? -
12. Re: Can't get MBean to participate in Service Life Cycle
sseifodd Oct 2, 2003 11:09 AM (in response to wargun02)I believe I am doing that.
Attached are my two files and my service.xml file:
Any idea what is wrong? -
13. Re: Can't get MBean to participate in Service Life Cycle
sseifodd Oct 2, 2003 3:51 PM (in response to wargun02)The problem with my code is the naming convention that I am using
Figured it out! -
14. Re: Can't get MBean to participate in Service Life Cycle
ayesha_ma Nov 5, 2004 5:15 AM (in response to wargun02)Three important points to watch out for
1/ MBean u create must have the same name as the implementing class
Eg: if the class is called TestStartup the Mbean must be called TestStartupMBean
2/ The implementing class must contain at least one public constructor
3/ Getters and setters must follow strict naming conventions