Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
0.24.0
-
None
-
Reviewed
Description
MBeans.java
static public ObjectName register(String serviceName, String nameName, Object theMbean) { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = getMBeanName(serviceName, nameName); try { mbs.registerMBean(theMbean, name); LOG.debug("Registered "+ name); return name; } catch (InstanceAlreadyExistsException iaee) { if (LOG.isTraceEnabled()) { LOG.trace("Failed to register MBean \""+ name + "\"", iaee); } else { LOG.warn("Failed to register MBean \""+ name + "\": Instance already exists."); } } catch (Exception e) { LOG.warn("Failed to register MBean \""+ name + "\"", e); } return null; } static private ObjectName getMBeanName(String serviceName, String nameName) { ObjectName name = null; String nameStr = "Hadoop:service="+ serviceName +",name="+ nameName; try { name = DefaultMetricsSystem.newMBeanName(nameStr); } catch (Exception e) { LOG.warn("Error creating MBean object name: "+ nameStr, e); } return name; }
In getMBeanName() if DefaultMetricsSystem.newMBeanName(nameStr); fails with some reason like mbean already exists, getMBeanName() logs the exception and returns null and mbs.registerMBean(theMbean, name) in register() tries to register with null and throws exception with the message 'Failed to register MBean "null"'.