// Build Engine object name
ObjectName engineObjectName = null;
try {
engineObjectName = new ObjectName(ENGINE_OBJECT_NAME);
} catch (MalformedObjectNameException e) {
throw new DeployerException("Cannot build Tomcat Engine MBean.", e);
} catch (NullPointerException e) {
throw new DeployerException("Cannot build Tomcat Engine MBean.", e);
}
// Ask the MBean server
Set<ObjectName> objectNames = null;
try {
// Get the list
objectNames = MBeanServerHelper.getMBeanServerServer().queryNames(engineObjectName, null);
} catch (JMXRemoteException e) {
throw new DeployerException("Cannot get Tomcat Engine MBean.", e);
}
// Find objects ?
if (objectNames.size() == 0) {
throw new DeployerException("No Tomcat Engine MBean was found in the MBean server");
}
// Return the domain of this object name
return (objectNames.iterator().next());
}