Bugs item #854907, was opened at 2003-12-05 19:35
Message generated for change (Settings changed) made by juhalindfors
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=854907&group_id=22866

Category: JBossMX
Group: v3.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Brian Madigan (bmadigan2003)
>Assigned to: Nobody/Anonymous (nobody)
Summary:  NullPointerException in ModelMBeanInvoker at startup

Initial Comment:
 I have defined an XMBean following the JBoss admin and
developer guide examples (starting at Page 119)

The XMBean descriptor validates ok against it's DTD,
and I don't find any discrepancies between the
descriptor and the implementing class.

During initialization, the XMBean fails to start,
throwing a NullPointerException during registration

Relevant portion of the stack trace is below:

[java] Caused by: java.lang.NullPointerException
[java] at
org.jboss.mx.modelmbean.ModelMBeanInvoker.preRegister(ModelMBeanInvoker.java:243)
[java] at
javax.management.modelmbean.RequiredModelMBean.preRegister(RequiredModelMBean.java:218)
[java] at
org.jboss.mx.modelmbean.ModelMBeanInvoker.preRegister(ModelMBeanInvoker.java:284)
[java] at
org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:148)
[java] at
sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
[java] at
org.jboss.mx.interceptor.ObjectReferenceInterceptor.invoke(ObjectReferenceInterceptor.java:59)
[java] at
org.jboss.mx.interceptor.MBeanAttributeInterceptor.invoke(MBeanAttributeInterceptor.java:43)
[java] at
org.jboss.mx.interceptor.PersistenceInterceptor2.invoke(PersistenceInterceptor2.java:93)
[java] at
org.jboss.mx.server.MBeanInvoker.invoke(MBeanInvoker.java:75)
[java] at
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:141)
[java] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
[java] at
org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:994)
[java] at
org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:954)
[java] at
org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:322)
[java] at
org.jboss.system.ServiceCreator.install(ServiceCreator.java:114)
[java] at
org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:155)
[java] at
org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)

Poking around in the source code (3.2.1), the only two
lines in preRegister( ) that are likely to be causing a
nullPointerException are these:

Descriptor mbeanDescriptor =
infoSupport.getMBeanDescriptor();

mbeanDescriptor.setField(.......
....

xmbean descriptor is attached.

----------------------------------------------------------------------

Comment By: Juha Lindfors (juhalindfors)
Date: 2003-12-06 01:20

Message:
Logged In: YES 
user_id=175239

Why are you extending RequiredModelMBean ? 

If you do that you need to ensure that ModelMBeanInfo is set
before registering the MBean. But you're invoking the
no-args constructor from superclass that won't set the metadata.

The programming idiom to use model MBeans is to create an
instance of the MMB and then configure it with a reference
to your POJO and the metadata that describes your interface:

ModelMBean mmb = new RequiredModelMBean();
mmb.setModelMBeanInfo(mymetadata);
mmb.setManagedResource("ObjectReference", mypojo);
server.registerMBean(objectName, mmb);

Or for XMBean:

ModelMBean mmb = new XMBean("http://url.to.my.descriptor";);
server.registerMBean(objectName, mmb);

I'll see if there's a reasonable default failure exception
that should be thrown when you use MMB incorrectly.



----------------------------------------------------------------------

Comment By: Brian Madigan (bmadigan2003)
Date: 2003-12-05 19:41

Message:
Logged In: YES 
user_id=774779

Attached MBean impl. just in case. 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=854907&group_id=22866


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to