|
From: Carlos Q. <car...@ge...> - 2002-01-28 15:18:10
|
>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 interf=
ace,
> nor any other method belonging to the ModelMBean interface. The example=
s in
> the RI are bad coded.
Ejem... ;-)
Then, what's the correct way? via server.setAttribute("ManagedResource",=20
object)
>
>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
>
>
>
> Hi Simon
>
> >> I am now trying to run the RI ModelMBean example on OpenJMX
> >>
> >> There are several problems that are obviously linked to
>
> the coding of
>
> >> the example itself - but then there appears to be a more
>
> significant
>
> >> issue when trying to invoke a method of class DynamicMBean or
> >> ModelMBean,
> >> on an instance of RequiredModelMBean, that has been successfully
> >> registered with the mbean server.
> >>
> >> For example, when mbeanObjectName referred to a successfully
> >> registered instance,
> >> the following call:
> >>
> >> server.invoke(mbeanObjectName,
>
> "javax.management.modelmbean.RequiredModelMBean.setManagedResource",
>
> >> new Object[] { new TestBean(),
>
> "ObjectReference"},
>
> >> new String[]{"java.lang.Object",
> >> "java.lang.String"});
> >
> > It's wrong, try this:
> >
> > server.invoke(mbeanObjectName,
> > "setManagedResource",
> > new Object[] {new TestBean(), "ObjectReference"},
> > new String[] {"java.lang.Object",
> > "java.lang.String"});
> >
> > Note the operation name.
> >
> > Hope helped
> >
> > Simon
>
> The behaviour is just the same either way - same stack trace
> - the problem is
> simply that RequiredModelMBean.invoke() make no attempt to
> match any of the
> methods defined in its own class tree! CF the code from the
> RI that tries
> to do the following:
>
> try
> {
> mmbOpHandle =3D
> (this.getClass()).getMethod(opMethodName, mmbSig);
> } catch (NoSuchMethodException nsml)
> {
> mmbLocalInvoke =3D false;
> }
>
> before checking the ModelMBeanInfo for the named operation.
>
> Sorry to cause confusion by including the fully qualified
> method name - I was
> actually just trying to draw attention to the fact that the
> javadoc specifically
> allows for this as well - in case this may not have been
> recognised/catered for.
>
> From the javadoc:
>
> RequiredModelMBean.invoke(java.lang.String opName, ...)
>
> opName - The name of the method to be invoked. The name can
> be the fully qualified
> method name including the classname, or just the method name
> if the classname is
> defined in the 'class' field of the operation descriptor.
>
> Roger
>
>
> _______________________________________________
> Openjmx-devel mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openjmx-devel
_______________________________________________
Openjmx-devel mailing list
Ope...@li...
https://lists.sourceforge.net/lists/listinfo/openjmx-devel
|