[subscription-list: null] message in logs, cannot create a n
weinstock.gabriel Jun 4, 2007 4:16 PMHi,
I'm trying to create an XMBean that listens for notifications from a Timer XMBean. It should simply log the notification and handback when it receives one. However, I never see the logging statement indicating my MBean has started up (or shut down for that matter), and when I look at the logs, I see these entries around my code:
2007-06-04 15:11:23,960 DEBUG [org.jboss.system.ServiceCreator] About to create xmbean object: domain.com:service=OmsService with code: com.domain.oms.xmbeans.impl.OmsService with descriptor: META-INF/oms-xmbean.xml 2007-06-04 15:11:23,991 DEBUG [org.jboss.system.ServiceCreator] Created bean: domain.com:service=OmsService 2007-06-04 15:11:23,991 DEBUG [org.jboss.system.ServiceConfigurator] SubscriptionList set to [subscription-list: null] in domain.com:service=OmsService
I'm putting all of my class files, the jboss-service.xml, and the oms-xmbean.xml file in a .sar file (oms.sar) and deploying to a JBoss 4.2.0 GA server. Here are the two source code files:
OmsService.java:
package com.domain.oms.xmbeans.impl; import org.jboss.system.ListenerServiceMBeanSupport; import org.jboss.logging.Logger; import javax.management.Notification; import com.domain.oms.xmbeans.OmsServiceMBean; public class OmsService extends ListenerServiceMBeanSupport implements OmsServiceMBean { private static final Logger LOG = Logger.getLogger(OmsService.class.getName()); public OmsService() { super(); } /* public String getName() { return "OmsService"; } */ public void startService() throws Exception { LOG.info("oms service starting up"); super.subscribe(true); } public void stopService() throws Exception { LOG.info("stopping oms service"); super.unsubscribe(); } public void handleNotification2(Notification notification, Object handback) { LOG.info("got " + notification + ", " + handback); } }
OmsServiceMBean.java:
package com.domain.oms.xmbeans; import org.jboss.system.ListenerServiceMBean; public interface OmsServiceMBean extends ListenerServiceMBean { }
And the .xml files:
jboss-service.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE server PUBLIC "-//JBoss//DTD MBean Service 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss-service_4_2.dtd"> <server> <mbean code="com.domain.oms.xmbeans.impl.OmsService" name="domain.com:service=OmsService" xmbean-dd="META-INF/oms-xmbean.xml"> <attribute name="SubscriptionList"> <subscription-list> <mbean name="jboss.monitor:name=Heartbeat,type=Timer"> <notification type="jboss.monitor.heartbeat"/> </mbean> </subscription-list> </attribute> </mbean> </server>
oms-xmbean.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd"> <mbean> <description>oms service</description> <class>com.domain.oms.xmbeans.impl.OmsService</class> <constructor> <description>the default constructor</description> <name>OmsService</name> </constructor> <attribute access="write-only" setMethod="setSubscriptionList"> <name>SubscriptionList</name> <type>org.w3c.dom.Element</type> </attribute> <operation> <name>startService</name> <return-type>void</return-type> </operation> <operation> <name>stopService</name> <return-type>void</return-type> </operation> <operation> <name>handleNotification2</name> <parameter> <name>notification</name> <type>javax.management.Notification</type> </parameter> <parameter> <name>handback</name> <type>java.lang.Object</type> </parameter> <return-type>void</return-type> </operation> </mbean>
Can someone tell me what I'm doing wrong? I've been debugging this for the last 4 days and getting nowhere. I can't determine why the subscription-list element is coming back null, or why the service start method is never invoked.
By the way, I did enable the Timer (heartbeat) service in jboss-monitoring.xml.
Any help would be SO greatly appreciated,
Thanks,
Gabe