7 Replies Latest reply on Nov 8, 2002 4:31 AM by Juha Lindfors

    createMBean:  NullPointerException

    Erik Newbie

      Hi,

      I've switched to JBoss 3.0.2 and I'm still trying to register a ModelMBean. I make a connection to the MBeanServer (from a remote client) with the following call

      RemoteMBeanServer connector = new RMIConnectorImpl ( (RMIAdaptor) this.initialContext.lookup("jmx:server:rmi"));

      After that I call getMBeanCount on the connector, it returns 144. But when I want to register a new modelmbean using the following code

      name = new ObjectName("test:name=MijnBoon");
      connector.createMBean ("javax.management.modelmbean.RequiredModelMBean",
      name);

      I get a MBeanException does anyone has any idea what I'm doing wrong ?

      The complete stacktrace of the MBeanException is listed here

      MBeanException: preRegister() failed [ObjectName='test:name=MijnBoon', Class=javax.management.modelmbean.RequiredModelMBean (javax.management.modelmbean.RequiredModelMBean@abe654)]
      Cause: java.lang.NullPointerException
      at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:187)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:975)
      at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:273)
      at org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl.createMBean(RMIAdaptorImpl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub.createMBean(Unknown Source)
      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.createMBean(RMIConnectorImpl.java:219)
      at jmx.erik.ModelMBeanInfoBuilder.registerMBean(ModelMBeanInfoBuilder.java:213)
      at jmx.erik.MijnBoon.main(MijnBoon.java:69)
      + nested throwable:
      java.lang.NullPointerException
      at org.jboss.mx.modelmbean.ModelBase.preRegister(ModelBase.java:216)
      at javax.management.modelmbean.RequiredModelMBean.preRegister(RequiredModelMBean.java:218)
      at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:175)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:975)
      at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:273)
      at org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl.createMBean(RMIAdaptorImpl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)