3 Replies Latest reply on Feb 14, 2013 12:45 PM by foutjo

    How to access a Singleton Session Bean

    foutjo

      I have a EJB Singleton Session bean that I want to access from a java program.

      The java program is called from an EJB Session bean.

       

      I tried use the injection @EJB annotation but this did not work.  The Singleton Session

      bean object was null.

       

      I tried useing the EJBContainer object to get a context but this blew up.  (see below)

       

         final Context context = EJBContainer.createEJBContainer().getContext();/

         MySessionBean mbean = (MySessionBean) context.lookup("java:global/MySessionBean");

       

       

      Could one of you JBoss experts please tell me how I can access an EJB Singleton session bean from a java program

      that is called from an EJB Session bean?

       

      Any help is greatly appreciated.

       

      Thanks!