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.
The ejb-jar.xml file (ith the seam interceptor declared inside) had accidentally been deleted. Problem solved.