private static String getSystemProperty(EmsBean runtimeMBean, String propertyName) throws Exception {
// We must use reflection for the Open MBean classes (TabularData and CompositeData) to avoid
// ClassCastExceptions due to EMS having used a different classloader than us to load them.
EmsAttribute systemPropertiesAttribute = runtimeMBean.getAttribute("systemProperties");
Object tabularDataObj = systemPropertiesAttribute.refresh();
Method getMethod = tabularDataObj.getClass().getMethod("get",
new Class[] { Class.forName("[Ljava.lang.Object;") });
// varargs don't work out when the arg itself is an array, so specify the parameters explicitly using arrays.
Object compositeDataObj = getMethod.invoke(tabularDataObj, new Object[] { new Object[] { propertyName } });
getMethod = compositeDataObj.getClass().getMethod("get", String.class);