Bonjour à toutes et à tous.

Je développe une serie de classes de tests sous forme de MBean et je me retrouve confronté à un petit souci assez gênant !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName o1 = new ObjectName("test.mbeans:type=TestString");
ObjectName o1 = new 
		PerfRunnableMBean mb1 = new TestString();
mbs.registerMBean(mb1, o1);
Voici la trace obtenue :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Exception in thread "main" javax.management.NotCompliantMBeanException: MBean class test.TestString does not implement DynamicMBean, neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class test.TestString is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: test.TestString: Class test.TestString is not a JMX compliant MXBean)
	at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:160)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:305)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
	at test.MainTest.main(MainTest.java:23)
Pour info, voici l'interface que j'utilise :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
package test;
 
public interface PerfRunnableMBean {
 
	public void run();
	public long getElapsedTime();
}
Elle est pourtant conforme à la spécification JMX non ?

et l'entête de ma classe ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
public class TestString implements PerfRunnableMBean {
Merci de votre aide !