4 Replies Latest reply on Aug 14, 2003 7:44 AM by Tanja Ertl

    Can't find MBeanServer

    Tanja Ertl Newbie


      I'm very new at JBoss and MBEans ans suchs things.

      I try to acess the DestinationManager MBean from My Code, but I can't find the MBeanServer.

      ArrayList servers = MBeanServerFactory.findMBeanServer(null);
      if (servers == null) {
      throw new Exception("No MBeanServer found.");
      else {
      MBeanServer server = (MBeanServer) servers.get(0);
      ObjectName on = new ObjectName("jboss:service=DestinationManager");
      String[] param = {
      "TanjaQueue", "tanja"};
      String[] sig = {
      "java.lang.String", "java.lang.String"};
      server.invoke(on, "destroyQueue", param, sig);

      If I try to run it, I get an IndexOutOfBoundsException: Index: 0, Size: 0, the Array List has the size 0.

      Can anyone help me please?