1

I get a ThreadMXBean proxy for remote JVM as

 ObjectName objName = ManagementFactory.getThreadMXBean().getObjectName() ;


  ThreadMXBean proxy = JMX.newMBeanProxy(MBeanServerConnection, objName, ThreadMXBean.class);

However, when I call the following, it says it can't convert from CompositeDataSupport to ThreadInfo.

 ThreadInfo tInfo = proxy. getThreadInfo(true, true);

Shouldn't the proxy take care of all the conversion? Besides, I'm calling the getThreadInfo() on effectively ThreadMXBean.

Chris Nauroth
  • 9,614
  • 1
  • 35
  • 39
RRM
  • 2,495
  • 29
  • 46

1 Answers1

1

ThreadMXBean is an MXBean. Your code has called JMX#newMBeanProxy. The proxy returned by this method is not capable of handling the properties of MXBeans. Instead, use JMX#newMXBeanFactory to obtain a proxy capable of handling the properties of MXBeans.

ThreadMXBean proxy = JMX.newMXBeanProxy(MBeanServerConnection, objName, ThreadMXBean.class);
Chris Nauroth
  • 9,614
  • 1
  • 35
  • 39