2 Replies Latest reply on Jul 31, 2008 3:23 PM by Thiago Rodrigues

    Getting remote MBeanServer. Please, help-me!

    Thiago Rodrigues Newbie

      Hello, people!!!!
      I already read it: http://wiki.jboss.org/wiki/HowDoIAddANotificationListenerToARemoteMBeanServer?action=e&windowstate=normal&mode=view
      but it's not working.. Perhaps because I didn't know how to do it: "The Listener stub would be created with rmic and deployed to the server, typically by dropping a jar into the server/xxx/lib directory"
      Perhaps the answer of my problem isn't there...

      See my problem:

      I have two windows servers... Each server is running 2 instances of jboss as service.


      on firstserver:8080, I have a webapplication that receves notifications of jboss mbeans, like subdeployers of maindeploy.
      But only local notifications is working... I tryed to add remote notifications (firstserver:8180, secondserver:8080 and secondserver:8180), but I didn't have sucess...
      What I have to do, to an application that is runing in firstserver:8080 receves notifications of things that occurs on other instances of jboss? (one in the same server: firstserver:8180, and others in remote instances secondserver:8080, secondserver:8180).

      I have sucess on the same instance that my webapplication is running, putting this code in my webapplication:

      NotificationListener notif = new NotificationListener(){
      public void handleNotification(Notification notification, Object handback) {
      //so something in my application; show a message
      List list = MBeanServerFactory.findMBeanServer(null);
      MBeanServer server = (MBeanServer)list.iterator().next();
      ObjectName name = new ObjectName("jboss.web:service=WebServer");
      server.addNotificationListener(name, notif, null, null);

      It's working! I used mbean jboss.web:service=WebServer, than, when I deploy .war, a message appers in my application. But only if the deploy happens in the same jboss instance that my application is running. How do I do it to work in the others instances, including the remotes instances?