I am not experiencing the "The MBean named exists but does not implement the 
NotificationBroadcaster interface"-error that you get as long as I specify the 
mbean and not the management interface (type=Management) as a broadcaster.

But my problem is that although the log files tells me that my broadcaster has 
been subscribed to by the listener, the listener does not receive any 
notifications.

After some investigation I found out that when using a 
ListenerServiceMBeanSupport together with a SubscriptionList configuration to 
subscribe to notifications sent by an EJB3 service bean it seems like the 
ListenerServiceMBeanSupport bean subscribes to the ServiceDelegateWrapper class 
instead of the defined bean in the SubscriptionList.

To work around this the following code could be added to the 
ServiceDelegateWrapper class:


  |   @Override
  |    public void addNotificationListener(NotificationListener listener, 
  |                                                     NotificationFilter 
filter, 
  |                                                     Object handback) 
  |    {
  | 
  |       if (delegate instanceof ServiceContainer)
  |       {
  |          try
  |          {
  |             ((ServiceContainer) delegate).invoke("addNotificationListener",
  |                new Object[] {listener, filter, handback}, 
  |                new String[] {"javax.management.NotificationListener", 
  |                                    "javax.management.NotificationFilter",
  |                                    "java.lang.Object"});
  | 
  |          }
  |          catch (Exception e)
  |          {
  |             throw new RuntimeException(e);
  |          }
  |       }
  |    }
  | 
  |    @Override
  |    public void removeNotificationListener(NotificationListener listener, 
  |                                                           
NotificationFilter filter, 
  |                                                           Object handback)
  |    {
  | 
  |       if (delegate instanceof ServiceContainer)
  |       {
  |          try
  |          {
  |             ((ServiceContainer) 
delegate).invoke("removeNotificationListener", 
  |                new Object[] {listener, filter, handback}, 
  |                new String[] {"javax.management.NotificationListener", 
  |                                    "javax.management.NotificationFilter", 
  |                                    "java.lang.Object"});
  | 
  |          }
  |          catch (Exception e)
  |          {
  |             throw new RuntimeException(e);
  |          }
  |       }
  |    }
  | 

This has been tested with the 4.0.5 GA release and it seems to work fine. Is 
this a good way of solving this? Any other suggestions?

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991916
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to