-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b71
-
generic
-
generic
CR "6373926: No way to determine a problem with type mapping by current MXBean spec" is supposed to make clarifications in MXBean spec that in case of problems with type mapping the getCause() chain of ultimate exception should contain OpenDataException or InvalidObjectException.
The present moment RI does not comply with this rule in case of registering an MXBean, that references an unconvertable type. The NotCompliantMBeanException thrown does not contain the expected cause (OpenDataException).
See the example below:
-----------------------------------------------------
public class Main3 {
/** Creates a new instance of Main3 */
public static void main(String[] args) {
Main3 instance = new Main3();
instance.m1();
}
void m1() {
try {
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("domain:type=test");
mbs.createMBean(NotCompliant.class.getName(), oname);
} catch (Throwable e) {
e.printStackTrace();
}
}
public interface NotCompliantMXBean {
Random returnRandom();
}
public static class NotCompliant implements NotCompliantMXBean {
public Random returnRandom() {
return new Random();
}
}
}
-----------------------------------------------------
This produces the following output:
-----------------------------------------------------
javax.management.NotCompliantMBeanException: Not compliant
at com.sun.jmx.mbeanserver.Introspector.makeDynamicMBean(Introspector.java:194)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:915)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
at testjmx.Main3.m1(Main3.java:47)
at testjmx.Main3.main(Main3.java:37)
-----------------------------------------------------
The present moment RI does not comply with this rule in case of registering an MXBean, that references an unconvertable type. The NotCompliantMBeanException thrown does not contain the expected cause (OpenDataException).
See the example below:
-----------------------------------------------------
public class Main3 {
/** Creates a new instance of Main3 */
public static void main(String[] args) {
Main3 instance = new Main3();
instance.m1();
}
void m1() {
try {
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("domain:type=test");
mbs.createMBean(NotCompliant.class.getName(), oname);
} catch (Throwable e) {
e.printStackTrace();
}
}
public interface NotCompliantMXBean {
Random returnRandom();
}
public static class NotCompliant implements NotCompliantMXBean {
public Random returnRandom() {
return new Random();
}
}
}
-----------------------------------------------------
This produces the following output:
-----------------------------------------------------
javax.management.NotCompliantMBeanException: Not compliant
at com.sun.jmx.mbeanserver.Introspector.makeDynamicMBean(Introspector.java:194)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:915)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
at testjmx.Main3.m1(Main3.java:47)
at testjmx.Main3.main(Main3.java:37)
-----------------------------------------------------
- relates to
-
JDK-6373926 No way to determine a problem with type mapping by current MXBean spec
-
- Resolved
-