You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "nabarun (JIRA)" <ji...@apache.org> on 2018/10/03 21:38:26 UTC
[jira] [Closed] (GEODE-5455) ClassCastException in
MemberMBean.showOSMetrics, OSMetrics is not reconstructible from
CompositeData
[ https://issues.apache.org/jira/browse/GEODE-5455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
nabarun closed GEODE-5455.
--------------------------
> ClassCastException in MemberMBean.showOSMetrics, OSMetrics is not reconstructible from CompositeData
> ----------------------------------------------------------------------------------------------------
>
> Key: GEODE-5455
> URL: https://issues.apache.org/jira/browse/GEODE-5455
> Project: Geode
> Issue Type: Bug
> Components: jmx
> Affects Versions: 1.4.0
> Reporter: Kenneth Howe
> Assignee: Kenneth Howe
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.7.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The following code snippet throws
> {code}
> Exception in thread "main" java.lang.ClassCastException: javax.management.openmbean.CompositeDataSupport cannot be cast to org.apache.geode.management.OSMetrics at com.sun.proxy.$Proxy0.showOSMetrics(Unknown Source)
> {code}
> {code:java}
> public static MBeanServerConnection getLocalMBeanServerConnectionStatic(int pid) {
> try {
> String address = ConnectorAddressLink.importFrom(pid);
> JMXServiceURL jmxUrl = new JMXServiceURL(address);
> return JMXConnectorFactory.connect(jmxUrl).getMBeanServerConnection();
> } catch (IOException e) {
> throw new RuntimeException(
> "Of course you still have to implement a good connection handling");
> }
> }
> public static void main(String[] args) throws IOException,
> MalformedObjectNameException, InstanceNotFoundException, ReflectionException {
> MBeanServerConnection mbeanServerConnection = getLocalMBeanServerConnectionStatic(127510);
> ObjectName mbeanName = new ObjectName("GemFire:type=Member,member=server1");
> MemberMXBean
> memberbeanInstance =
> (MemberMXBean) MBeanServerInvocationHandler
> .newProxyInstance(mbeanServerConnection, mbeanName, MemberMXBean.class, Boolean.TRUE);
> System.out.println(Arrays.toString(memberbeanInstance.listRegions()));
> OSMetrics cdOSMetrics = memberbeanInstance.showOSMetrics();
> //.....
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)