Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-5455

ClassCastException in MemberMBean.showOSMetrics, OSMetrics is not reconstructible from CompositeData

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4.0
    • 1.7.0
    • jmx

    Description

      The following code snippet throws

      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) 
      
        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();
          //.....
        }
      

      Attachments

        Issue Links

          Activity

            People

              khowe Ken Howe
              khowe Ken Howe
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m