users@glassfish.java.net

Re: CDI broken between EJB and JPA modules

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Apr 2010 10:40:06 PDT

Hi jszczepankiewicz.

I have already done everything you said, and the @Inject does indeed work in that case. (See my earlier attachment named AppMergedWithSource.ear. It is setup exactly as you described.)

The problem, however, is that in that scenario the @PersistenceContext annotation in my DaoImpl class doesn't work. It results in this exception during deployment:

Caused by: java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName null
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.init(EntityManagerWrapper.java:122)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:163)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.find(EntityManagerWrapper.java:310)
at sample.persistence.impl.UserDaoImpl.find(UserDaoImpl.java:16)
at sample.service.UserService.loginByGuid(UserService.java:20)
...

Does your DaoImpl class use an EntityManager? If so, how did you inject the EntityManager?

Thanks,
-Dan
[Message sent by forum member 'theodan']

http://forums.java.net/jive/thread.jspa?messageID=395976