not able to update jmx attribute value of type boolean literal
rajajboss Dec 4, 2014 8:29 AMHi ,
When I am updating mbean attribute value of type boolean, am getting the bellow error.please note that it is not java.lang.Boolean.But It is working for java.lang.Boolean type.
Code:
String host = "localhost";
int port = 9999;
String urlString ="service:jmx:remoting-jmx://" + host + ":" + port;
System.out.println("\n\n\t**** urlString: "+urlString);;
JMXServiceURL serviceURL = new JMXServiceURL(urlString);
JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null);
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
ObjectName objectName = new ObjectName(bname.toString());
javax.management.Attribute changedAttributeValue = null;
try {
if(editedAttribute.getType().equals("java.lang.Boolean")||editedAttribute.getType().equals("boolean"));
//changedAttributeValue = new javax.management.Attribute(editedAttribute.getName(), new Boolean(editedAttribute.getValue()));
changedAttributeValue = new javax.management.Attribute(editedAttribute.getName(), Boolean.valueOf(editedAttribute.getValue()));
connection.setAttribute(objectName,changedAttributeValue);
System.out.println("attrinute value changed..........................");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
Error:
java.io.IOException: java.lang.ClassNotFoundException: No classloader available
at org.jboss.remotingjmx.protocol.v2.ServerProxy$SetAttributeHandler.handle(ServerProxy.java:1111)
at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:152)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: No classloader available
at org.jboss.marshalling.AbstractClassResolver.getClassLoaderChecked(AbstractClassResolver.java:91)
at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:135)
at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:116)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:947)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1259)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:72)
at org.jboss.remotingjmx.protocol.v2.ServerProxy$SetAttributeHandler.handle(ServerProxy.java:1109)
... 4 more