JMX - auto register MBeans when deploying applications

I need some direction with JMX and Java EE.

I know (after weeks of research) that the JMX specification is missing as it rolls out. For what I'm looking for there are several vendor specific implementations, but none are cross vendor. I would like to automate MBeans deployment and server registration. I need a server to download and register my MBeand when the application is deployed and uninstall when the application is not deployed.

I am developing with: NetBean 6.7.1, GlassFish 2.1, Java EE 5, EJB 3

More specifically, I need a way to manage the timer starts. My application needs to run various archiving agents and batch reporting. I was hoping that JMX would give me remote access to create and manage timer services and allow the user to create their own schedule. If the JMX is automatically registered when the application is deployed, the user can immediately connect and control the schedule. On the other hand, how can an EJB connect / access an MBean?

Thank you very much in advance. Gadi.

+2


a source to share


1 answer


I researched JMX and EJB at Glassfish a few years ago, so I don't remember all the details. But it might help.

  • JMX specific to Glassfish . Glassfish has AMX and a custom MBean can be deployed. AFAIK, beans like this are for monitoring the server itself, not for interacting closely with a specific application. Such a bean can be made persistent and Glassfish will retain its value somewhere across a restart. Perhaps take a look.

  • Registration and search . You can register an MBean from the application at any time using MBeanPlatform

    or MBeanServer

    . See this link, I don't remember exactly. You can also find another JMX bean and invoke operations on them. However, the names to look for are a bit crazy. You can register an MBean when the application is. begin with .

  • Class loaders and deployment . MBeans and EJB instances are in great Classloader

    . I think you will need to put .jar

    with the MBean implementation in the Glassfish deployment directory structure, or add it to the list .jar

    in the classpath via the admin console. You can register a bean from an EJB module relatively easily, but a bean cannot easily access an EJB, at least from my experience.



I was able to use a simple JMX to display statistics from my EJB application and it worked relatively well. But I don't know if it is adequate to have something more interactive like in your case when you want the EJB to change its behavior depending on the timer configured with the JMX. I am afraid you will have problems with this approach.

Hope this helps, despite the uncertainty of what I remember.

+4


a source







All Articles