You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 23 Members of 4546 |
| Forum: Seam Users |
02. Oct 2008, 15:44 CET | Link |
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.