2 Replies Latest reply on Jan 12, 2006 9:55 AM by andy

    Exception in thread

    andy Newbie

      Hi All,

      Hopefully someone will be able to clue me in to how to resolve this problem. Supposedly it was fixed by JBAS-1787 but it doesn't look like it to me.

      I am trying to query and get mbeanInfo for all mbeans in JBoss using RMI.
      I get an nullPointerException when I attempt method getMBeanInfo for an mbean that has a DOM element. The exception occurs when trying to access mbean jboss.jca:service=ManagedConnectionFactory,name=DefaultDS

      Exception in thread "main" java.lang.NullPointerException
      at javax.management.modelmbean.DescriptorSupport.readObject(DescriptorSupport.java:1354)

      This is extremely easy to recreate, all you have do is download and start JBoss and run the code below from an IDE.

      The code I am using is as follows:

      import java.util.Iterator;
      import java.util.Set;
      import javax.management.*;
      import javax.naming.InitialContext;

      public class JMXBrowser implements java.io.Serializable
      {
      public static void main(String[] args) throws Exception
      {
      InitialContext ic = new InitialContext();
      MBeanServerConnection mbsc = (MBeanServerConnection) ic.lookup("jmx/invoker/RMIAdaptor");
      ObjectName oname = new ObjectName ("*:service=ManagedConnectionFactory,*");

      Set setOfJbossMbeans = mbsc.queryNames(oname, null);
      Iterator it = setOfJbossMbeans.iterator();
      while( it.hasNext() )
      {
      ObjectName on = (ObjectName) it.next();
      MBeanInfo mbi = mbsc.getMBeanInfo(on);
      }
      }
      }


      I am running JBOSS 4.03SP1 on Windows XP (it also occurs on Red Hat Linux) which I just downloaded to see if the fix actually works as described in JBAS 1787. What seems to be missing in the description for the bug fix is the exact configuration needed resolve the problem (possibly with respect to the java options required when starting JBoss and the client side jars needed in the classpath). This is not fully described in the bug fix. The JBAS 1787 mentions that you need to have the following java option set: -Djava.endorsed.dirs=%JBOSS_HOME%\lib\endorsed. I noticed it at the bottom of under :restart in run.bat but is not set by default if needed. Why not?


      Thank you in advance for your help.

      - andy