Welcome to the new Spring.io forums!
If this is your first visit, be sure to check out the
by clicking the link above, and for security reasons, use the
forgot password link to reset your password..
You may have to register before you can post: click the register
link above to proceed. To start viewing messages, select the forum that you want to visit
from the selection below.
The more I experiment with this, the less likely this is. Maybe my problem was poorly defined. I need to start an MBean service when an EJB is deployed. There is no servlet in this scenario. This is not ideal, but there seems to be absolutely no way to create a self-deploying MBean service. Therefore, I have tied it to an EJB that will provide an access point and (hopefully) load the MBean service and start it on deployment.
As I see it, the problem is that Spring's JMX functionality pre-supposes that you will tie your JMX service to a servlet where it can be loaded on initialization. I do not see an initialization option in the world of EJBs. As an aside, this assumption is pretty limiting. I can't imagine very many people that would want to only use a service with a webapp and never without the webapp. It's bad enough that I'm trying to tie it to an EJB. This seems to defeat the purpose of a service.
Please correct me if I'm wrong. I'd love to be wrong in this case.
It is true that there is no single initialization point for EJBs. IMHO that is a flaw of the EJB spec. Initialization is however covered in the servlet spec. Therefore I proposed to use a servlet or listener (spring does provide usefule classes here out of the box).
Actually I see no obstacle in initializing your JMX bean from a listener or servlet. Just deploy a war with a ContextLoaderListener loading your application context where the JMX bean is defined. That would be all.
Thanks for the reply. I decided to build a war for my JMX MBean. It is weird to me to do this, as I am accustomed to building a sar for this purpose, but it is turning out to be a worthwhile endeavor. Every time I have difficulty, there turns out to be an easy answer that I overlooked because it is in fact so simple. I have always enjoyed Spring's proxying to keep my apps decoupled, but I see now how very useful it is in other facets of app development. Now I can use my EJB as a mere facade that acts as a transactional access point for distributing my app components, as I desired. I just needed to look at the problem differently. Thanks again.