3 Replies Latest reply on May 12, 2008 11:29 AM by Ananthan Rudran

    How to find EJB3 bean from a seam pojo class

    Harpreet  Dhanoa Newbie

      I want to use the EJB stateless bean which also has a annotation of @webservice in a seam pojo class


      1)I tried defining the EJB stateless class with @Name anotation
      2) Also tried to define the EJB in component.xml with JNDI name


      3) Also this that is suggested in the form



      <component auto-create="true" class="org.domain.dunno.session.ForaBean" name="fora"> 
      





      Please point me to right example or docs.
      I will really appreciate your help!


      Thanks !




        • 1. Re: How to find EJB3 bean from a seam pojo class
          Tom Goring Apprentice

          Should be as simple as adding @Name on your SLSB and @In on your POJO.


          E.g.




          @Local
          public interface MessageManager  {
             public void method();
          }



          @Stateless
          @Local(MessageManager.class)
          @Name("messageManager")
          @AutoCreate
          public class MessageManagerBean implements MessageManager {
          ..
          }
          





          @Name
          public class MyPojo {
           
          @In
          MessageManager messageManager 
          
          ....
          
          }


          • 2. Re: How to find EJB3 bean from a seam pojo class
            Harpreet  Dhanoa Newbie

            Thanks a lot Tom for your response.
            Actually I tried this and the exception i got is that it  could not find the SLSB, is this proven solution in seam to find EJB?


            may be at the time pojo componenet is created, the EJB class(component) is not there (or not yet created..)


            I will be more happy to also get a solution that does not make my EJB a seam component (ofcourse i also don't want to manually lookup in the pojo class)

            I am wondering may be there is something that i define the EJB class
            as a seam component in component.xml


            this is my 2nd posting in this forum, i am really glad somebody reply because i was really disappointed last time because i am still wating on that from a week :) so thanks a lot again!

            • 3. Re: How to find EJB3 bean from a seam pojo class
              Ananthan Rudran Newbie

              The common mistake is to inject the Bean implementaion rather than the interface.Did you inject the interface as shown in the exaple above