This content has been marked as final.
Show 4 replies
-
1. Re: Retrieve Wildfly version number from application code
jaysensharma Dec 4, 2014 4:01 AM (in response to chrkoelle)May be you can try using the MBean approach to get that information:
For WildFly 8.1 try the following kind of MBean code from inside the WildFly container, You can use the same MBean to get this information remotely as well.:
<%@ page import="javax.management.*,javax.management.remote.*" %> <% try{ MBeanServer mbeanServer = java.lang.management.ManagementFactory.getPlatformMBeanServer(); ObjectName objectName=new ObjectName("jboss.as:management-root=server"); String releaseCodename = (String) mbeanServer.getAttribute(objectName, "releaseCodename"); String releaseVersion = (String) mbeanServer.getAttribute(objectName, "releaseVersion"); out.println("<center><h1>"+ releaseCodename + " - "+ releaseVersion+"</h1></center>"); } catch(Exception e) { e.printStackTrace(); } %>
-
2. Re: Retrieve Wildfly version number from application code
chrkoelle Dec 4, 2014 4:15 AM (in response to chrkoelle)Thank you very much. That works for me.
-
3. Re: Retrieve Wildfly version number from application code
ctomc Dec 4, 2014 7:44 AM (in response to chrkoelle)1 of 1 people found this helpfulOther option would be to directly ask for it.
add dependency to module org.jboss.as.version to your deployments jboss-deployment-structure.xml or manifest.mf
and than you can get version info by simply looking up constants on class org.jboss.as.version.Version
-
4. Re: Retrieve Wildfly version number from application code
chrkoelle Dec 5, 2014 6:13 AM (in response to ctomc)Yes, thank you. That works also.