Getting a service's DeploymentInfo fails in EAP 5
Issue
-
Need to retrieve the application name from inside the application.
-
A JBoss listener Service defined as follows:
public class JBossApplicationListener extends ListenerServiceMBeanSupport implements JBossApplicationListenerMBean;
@Override
public void postRegister(Boolean registrationDone) {
super.postRegister(registrationDone);
if (registrationDone) {
try {
DeploymentInfo deploymentInfo = this.getDeploymentInfo();
log.info("====> shortName" + deploymentInfo.shortName);
} catch (JMException e) {
log.error("Could not get Deployment Info: " + e);
}
}
}
- listener-service.xml looks like this:
<mbean code="com.abc.listener.JBossApplicationListener" name="com.abc.listener:name=JBossApplicationListener">
<attribute name="SubscriptionList">
<subscription-list>
<mbean name="*:service=invoker,*" handback="anObject"></mbean>
<mbean name="jboss.monitor:*"></mbean>
<notification type="JBOSS_MONITOR_NOTIFICATION"></notification>
<mbean name="JMImplementation:type=MBeanServerDelegate">
<notification type="JMX.mbean"></notification>
</mbean>
</subscription-list>
</attribute>
</mbean>
- Results in the following ERROR:
ERROR [JBossApplicationListener] Could not get Deployment Info: javax.management.InstanceNotFoundException: jboss.system:service=ServiceDeployer is not registered.
Environment
- Red Hat JBoss Enterprise Application Platform [EAP]
- 5.0.0.GA
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
