we're currently in the process to switch our projects and infrastructure from JBoss 4.2.3 (it's really old, I know) to JBoss 7.x.
We have a couple of management services that we used to invoke through the old JMX-Console, e.g. in order to manually clear and rebuild caches, etc.
The beauty of that approach was that we only needed to write an MBean to expose the functionality we needed.
The problem is that in JBoss 7.x there seems to be no JMX-Console (yet).
I found a suggestion to build a JMX-Console like interface using JSF and a managed bean instead of the MBeans
but that would still require some work in order to provide the interface for each management method as well as the menu to access those methods (there are quite a lot and I'd like to have them grouped somehow).
Additionally, we'd still have to use our MBeans, although they'd now be annotated with @Singleton rather than @Service.
Thus we'd have to add at least two classes now: the MBean/Singleton and the JSF Managed Bean.
So here's my question: is there any less intrusive/expensive way to expose those management methods in a web console?
Additionally, does anyone know if and when there will be a new version of the JMX-Console?
Thanks in advance.
Dimitris, the ported JMX-Console looks quite usable, although I miss some nice features like the JNDI View etc. (I think we could add them ourselves, though).
One more question (I'm just getting started with the changes that happened since JBoss 4.x ):
How would I create an MBean that is accessible through the ported JMX-Console?
Apparently, the @Service and @Management annotations are gone.
As an alternative to a web based app that will be exposed over the same port as any web applications you deploy yourself have you considered using jconsole instead?
This is accessible over the port used for the native management interface and is secured using the same mechanism as is used for the native interface.
Darran, that might be an option but I think we'll still need a web console since we sometimes need to do some management operations from systems that don't have a JConsole installed at that moment.
Thus we'd like to have a browser as the only requirement for that.
Additionally, you wrote
The first release to contain this will be JBoss AS 7.1.0.Final.
Can you give any information on when the final version will be published?
for the @Service @Management have a look at the following post from Adam. It desribes how to use the @Singleton @Startup as your MXBean. I use it internally in my project and I enjoy all "injection" benefits...
For the JNDI dump have a look here. It's not my code found it on the net, I adapted and mavenized it a bit
Hope that helps,
Keep care with this solution. You have all this injection stuff beacause the ejb-container creates this singleton instance, call's @PostConstruct and so on ...
If you register this instance by the MBeanServer as MBean and call later this instance via the MBeanServer, the call is invoked in the context of the MBeanServer without transaction, security context and so on.
You will "land" in the ejb-container during the first call to an injected ejb.
By the "old" @Service-anntoated MBean, the MBean-call was also in the context of the ejb-container.
We run in some problems by porting an application (from JBoss 4.3) with this solution.
E.g. in a MBean method we call multiple ejb's. Now has each ejb-call his own transaction, in the "old" version we had only one transaction for all calls. It's a litte difference ;-)
Well, I didn't see that.
It looks quite usable, but I'd have a couple of suggestions:
- It would be nice if I could display the entire JNDI tree in one go instead of having to manually expand all the nodes.
- The view isn't that readable if you have longer package names, due to the restricted width and the line wrapping.
- There is a vertical scroll bar but no horizontal one. Thus part of the information is hidden below the vertical scroll bar.
Christos, using that approach might be simple but what I don't like about it is that I'd have to put the registration code into the @PostConstruct method in every MBean (we can't introduce a super class in the MBeans' hierarchy).
I found this project which uses a CDI extension for JBoss 6: http://code.google.com/p/jmx-annotations/
Here the MBeans would be singletons like in Adam's suggestion and are wrapped with a DynamicMBean instance to provide information.
The MBeans are then automatically registered in the post construct method of the injection target.
In JBoss 7, however, this doesn't work since for EJBs the injection target's postConstruct() method isn't called (see here for example: https://community.jboss.org/message/716573#716573).
Thus I adapted the usage of this project and it seems to work so far:
- MBeans are no EJBs anymore
- There is a singleton EJB that loops over all beans in the BeanManager, finds the mbeans, creates instances and registers them with the MBean server.
True, they don't run in a transactional context, but that's something we can live with.
@Daniel: how did you port your old-style MBeans to JBoss 7?