-
1. Re: How to programmatically obtain the release version from JBoss 7 at runtime?
nickarls Jan 4, 2012 4:58 PM (in response to ultrapod)1 of 1 people found this helpfulYou can create a
ModelControllerClient and read it from an attribute in the root node.
-
2. Re: How to programmatically obtain the release version from JBoss 7 at runtime?
ultrapod Jan 4, 2012 6:56 PM (in response to nickarls)That was a useful clue, thanks. Here's how I did it:
ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getByName("localhost"), 9999); ModelNode op = new ModelNode(); op.get(ClientConstants.OP).set("read-resource"); ModelNode returnVal = client.execute(op); logger.info("release-version: " + returnVal.get("result").get("release-version").asString()); logger.info("release-codename: " + returnVal.get("result").get("release-codename").asString());
This was a useful link:
http://community.jboss.org/wiki/DetypedDescriptionOfTheAS7ManagementModel
As was this, which is part of the (apparently incomplete?) JBoss 7 Management System documentation:
https://docs.jboss.org/author/display/AS7/Management+resources
If you want to get at this info via http, you can see it here:
http://localhost:9990/management/
And from the jboss-admin command line interface, you can get the info from these commands:
/:read-attribute(name=release-version)
/:read-attribute(name=release-codename)
I'm including this extra stuff because I wasn't at all familiar with the various new JBoss Management interfaces (and I'm still not, really) and it seemed like it might be useful to others who come across this thread.
-
3. Re: How to programmatically obtain the release version from JBoss 7 at runtime?
stianst Jan 6, 2012 9:05 AM (in response to ultrapod)1 of 1 people found this helpfulThe AS management is exposed in JMX on 7.1 (tried on 7.1.0.CR1b), so you can get to this pretty much with your original code just by changing the ObjectName + attribute.
ObjectName: jboss.as:management-root=server
Attribute: releaseVersion
-
4. Re: How to programmatically obtain the release version from JBoss 7 at runtime?
ultrapod Jan 6, 2012 11:08 AM (in response to stianst)Thanks - I like this better. Since the old-style JMX console has been removed, I'm struggling to figure out where things got moved to.
-
5. Re: How to programmatically obtain the release version from JBoss 7 at runtime?
stianst Jan 6, 2012 11:25 AM (in response to ultrapod)Have you tried jconsole? Does the same job as the "old-style JMX console".
-
6. Re: How to programmatically obtain the release version from JBoss 7 at runtime?
ultrapod Jan 6, 2012 3:53 PM (in response to stianst)Honestly, I had completely forgotten about jconsole, and I feel a little silly about that now. Thanks for reminding me!
-
7. Re: How to programmatically obtain the release version from JBoss 7 at runtime?
hhuynh Mar 14, 2012 1:59 AM (in response to stianst)This code works for JBoss 7.1.x
MBeanServer server = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("jboss.as:management-root=server"); String version = (String) (server.getAttribute(name, "releaseVersion")); but the bean doesn't exist for JBoss 7.0.2. Is there another approach to get version for 7.0.x releases?