1 Reply Latest reply on Nov 14, 2006 7:32 PM by Gavin King

    @Service MBEan as Seam component

    Aron Bartle Newbie

      Hello,

      Sorry for the newB-nature of this question, but I did do a fair amount of google/forum searching before posting.

      What I'm wondering is if it is possible to use a @Service annotated JBoss MBean also as a @Name annotated seam component (with APPLICATION scope I guess) -- such that Seam makes calls on the singleton instance.

      I tried something like this:

      @Service(objectName = "someapp:service=theManager")
      @Management(TheManager.class)
      @Name("theManager")
      @Scope(APPLICATION)
      @Interceptors(SeamInterceptor.class)
      public class TheManagerMBean implements TheManager {
       @PersistenceContext
       private EntityManager m_em;
       public Something getSomething() {
       return m_em.find(Something.class,"Something");
       }
      


      Then in a jsp I try to call "#{theManager.something.foo}".

      So what happens is it goes into getSomething just fine, but apparently Seam has created a new THeManagerMBEan instance for me, instead of using the MBEan singleton, because m_em is null.

      Is this something that is just not supported? Can a MBean be accessed directly using seam? Do all Seam components have to be Entity/Stateful/Stateless/some other POJO?

      Sorry if my question is facile, I'm new to all this JSP/JSF/Seam stuff.

      -Aron