-
1. Re: Registering as a listener to server startup
dsengupt Sep 8, 2004 11:53 AM (in response to dsengupt)This is what i've done so far, but it gives an exception - RuntimeOperationsException: MBean jboss.system:type=Server does not implement the NotificationBroadcaster interface.
Cause: java.lang.ClassCastException
I'm using JBoss 3.0.4
CODE:
MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).iterator().next();
Set servers = server.queryNames(new ObjectName("jboss.system:type=Server"), null);
Iterator it = servers.iterator();
while (it.hasNext())
{
ObjectName serverObjectName = (ObjectName)it.next();
MBeanInfo info = server.getMBeanInfo(serverObjectName);
System.out.println(info);
NotificationFilterSupport filter = new NotificationFilterSupport();
filter.enableType(Server.START_NOTIFICATION_TYPE);
server.addNotificationListener(serverObjectName, this, filter, null);
} -
2. Re: Registering as a listener to server startup
dimitris Sep 13, 2004 3:04 PM (in response to dsengupt)Hi,
the emition of the notification you want was added at v3.2+, so you won't find it in any of the 3.0.x versions.
If you considering a more generic JMX notification listener you can try out also:
http://www.jboss.org/wiki/Wiki.jsp?page=ExampleMinimalNotificationListener
If you want you MBean to deploy last, you may also play with the DeploymentPrefixSorther defined at ./conf/jboss-service.xml
Regards
/Dimitris -
3. Re: Registering as a listener to server startup
dsengupt Sep 14, 2004 11:58 AM (in response to dsengupt)Dimitris,
Thanks for the information. I will check the links and see what i can extract out of them. Regards,
-Deb