|
From: Bordet, S. <Sim...@co...> - 2002-01-28 15:08:34
|
Hi,
so, the question has been closed in jmx-forum. Guess what ?
It is a RI bug.
The spec says you cannot invoke setManagedResource via management =
interface, nor any other method belonging to the ModelMBean interface.
The examples in the RI are bad coded.
Simon
> -----Original Message-----
> From: Roger Holbrook [mailto:ro...@fl...]
> Sent: gioved=EC 24 gennaio 2002 0:32
> To: ope...@li...
> Subject: [Openjmx-devel] RE: OpenJMX and RI Examples - ModelMBean
>=20
>=20
>=20
> Hi Simon
>=20
> >> I am now trying to run the RI ModelMBean example on OpenJMX
> >>=20
> >> There are several problems that are obviously linked to=20
> the coding of=20
> >> the example itself - but then there appears to be a more=20
> significant
> >> issue when trying to invoke a method of class DynamicMBean or=20
> >> ModelMBean,
> >> on an instance of RequiredModelMBean, that has been successfully=20
> >> registered with the mbean server.
> >>=20
> >> For example, when mbeanObjectName referred to a successfully=20
> >> registered instance,
> >> the following call:
> >>=20
> >> server.invoke(mbeanObjectName,=20
> >> =20
> "javax.management.modelmbean.RequiredModelMBean.setManagedResource",
> >> new Object[] { new TestBean(),=20
> "ObjectReference"},
> >> new String[]{"java.lang.Object",=20
> >> "java.lang.String"});
> >
> > It's wrong, try this:
> >
> > server.invoke(mbeanObjectName,
> > "setManagedResource",
> > new Object[] {new TestBean(), "ObjectReference"},
> > new String[] {"java.lang.Object",=20
> > "java.lang.String"});
> >
> > Note the operation name.
> >
> > Hope helped
> >
> > Simon
>=20
> The behaviour is just the same either way - same stack trace=20
> - the problem is=20
> simply that RequiredModelMBean.invoke() make no attempt to=20
> match any of the=20
> methods defined in its own class tree! CF the code from the=20
> RI that tries
> to do the following:
>=20
> try
> {
> mmbOpHandle =3D=20
> (this.getClass()).getMethod(opMethodName, mmbSig);
> } catch (NoSuchMethodException nsml)
> {
> mmbLocalInvoke =3D false;
> }
>=20
> before checking the ModelMBeanInfo for the named operation.
>=20
> Sorry to cause confusion by including the fully qualified=20
> method name - I was=20
> actually just trying to draw attention to the fact that the=20
> javadoc specifically=20
> allows for this as well - in case this may not have been=20
> recognised/catered for.
>=20
> From the javadoc:
>=20
> RequiredModelMBean.invoke(java.lang.String opName, ...)
>=20
> opName - The name of the method to be invoked. The name can=20
> be the fully qualified=20
> method name including the classname, or just the method name=20
> if the classname is=20
> defined in the 'class' field of the operation descriptor.
>=20
> Roger
>=20
>=20
> _______________________________________________
> Openjmx-devel mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openjmx-devel
>=20
|