1 Reply Latest reply on Oct 2, 2008 7:28 PM by Alexandre Gattiker

    Injection does not occur with SMPC + EJBs + TestNG

    Alexandre Gattiker Newbie

      When using SMPC in EJBs, I get a NullPointerException in my TestNG tests because injection never occurs:


      |
      public class OntologySourceDAOTest extends SeamTest {
        @Test
        public void create() throws Exception {
          new ComponentTest() {
            protected void testComponents() throws Exception {
              UserTransaction tx = Transaction.instance();
              tx.begin();
      
              OntologySourceDAO dao = (OntologySourceDAO) Component
                  .getInstance(OntologySourceDAOSeamJPAImpl.class);
              OntologySource obj = dao.create(ontologyURI, identifier, name);
              ...
            }
          }
        }
      }
      
      @Name("ontologySourceDAO")
      @Stateless
      @AutoCreate
      public class OntologySourceDAOSeamJPAImpl ... {
        @In
        protected javax.persistence.EntityManager entityManager;
          ...
      }|




      The EntityManager does not get injected. If I remove the @Stateless annotation, it works. However I would like my DAO to be an EJB and to use a SMPC.


      Using Seam 2.1.0.CR1.