As the name suggests MBeans are to manage beans..
So if u want to monitor the application written in JAVA u can write
manged beans, for that.
Where as EJB is more about encapsulating about business logic.
I hope this helps.
But EJBs can also be MBeans. So, I guess what I'm asking is, what does an application get from being a JBoss service as opposed to just an EJB application?
Can you explain what you mean by 'But EJBs can also be MBeans', EJBs and MBeans are two completely different things.
If by 'things' you mean concepts then yes, they are different things, but they are not exclusive of each other.
An MBean is simply a management interface for the underlying object. The interface has been registered with a lookup facility (MBeanServer derivative). The object itself can be anything: POJO, EJB, etc. Sometimes the object itself provides the management code, sometimes it delegates that code to a separate object (for instance, a 'manager' object). I just recently looked at a document that described this better, but I can't seem to locate it again. *drat*
Therefore, what I am referring to is an EJB that has registered itself as an MBean. If for instance, you had a small pool of stateful EJBs, you could monitor to see how many were in a certain state (like checking user activity across the application), or even allow you to reset that state. Obviously altering the lifetime of the EJB through the management interface would a bad thing, since you would be stepping the EJB containers toes, while wearing wooden shoes.
Now, with JBoss services (which AFAIK, must be an MBean), there is a separate descriptor stating when these services are started up and in what order. I am guessing that these should not be coded as EJBs, since something other than the EJB container is controlling their lifetime.
I hope this is somewhat clear, I think I even confused myself :)