jboss war deployed listener

2020-08-04 12:40发布

问题:

Is there a single listener one could implement to get a "war deployed" event?

I know there is the ContextServletListener. But it has to be 'attached' for each component (several web.xml files).

As a fallback, if I use ContextServletListener, how can I tell that the last component has been deployed?

As a side note: I need to be aware of a hot deploy when it finishes.

回答1:

JBoss registers a J2EEApplication MBean when a war is deployed. You can register a JMX notification listener with the JBoss MBeanServer's MBeanServer delegate (Object name: JMImplementation:type=MBeanServerDelegate) which will notify you when MBeans are registered and unregistered.

An ObjectName filter like jboss.management.local:J2EEServer=Local,j2eeType=WebModule,* for your registered notification listener will get you notifications for all deployed wars.

This will work for JBoss 4.x and 5.x.