How to get the Version Number for JBoss 7 from within a WAR?
For older JBoss these mechanis开发者_JAVA百科ms worked :
- Check for Class
org.jboss.mx.util.MBeanServerLocator
- Then use JSR77: Look for a JMX MBean with
*:j2eeType=J2EEServer,*
and get the attributeserverVersion
or
- Check for an MBean with name
jboss.system:type=Server
and get the value of attributeVersion
But for JBoss 7 neither MBean exists (nor any suitable class to check, with the WAR sitting in its OSGi cage). All I can do is for searching the JMX domain jboss.modules:
if it exists infer that this is a Jboss 7.
Is there a way to get the exact version number from within a WAR's init() ?
精彩评论