users@glassfish.java.net

Re: CDI _at_PersistenceContext not working when DAO/Bean in own Jar (GFv3)

From: Sahoo <Sahoo_at_Sun.COM>
Date: Sun, 02 May 2010 01:18:32 +0530

/META-INF/beans.xml seems redundant. It should not make any difference though. It looks like a bug to me. Please check issue tracker to see if this has been already filed or not.

Sahoo

Dominik Dorn wrote:
> DAO-Jar:
> /com/dominikdorn/.../domain/Artist.class
> /com/dominikdorn/.../dao/ArtistDao.class
> /com/dominikdorn/.../dao/JpaArtistDao.class
> /com/dominikdorn/.../domain/Title.class
> /com/dominikdorn/.../dao/TitleDao.class
> /com/dominikdorn/.../dao/JpaTitleDao.class
> /META-INF/persistence.xml
> /META-INF/beans.xml
>
>
> WebApp (War/Exploded):
> /index.xhtml
> /WEB-INF/web.xml
> /WEB-INF/beans.xml
> /WEB-INF/lib/dao.jar
> /WEB-INF/classes/com/dominikdorn/.../servlets/MySerlvet.class
>
> The Servlet @Injects the DAO (e.g. ArtistDao) which works, however,
> the EntityManager in the DAO is not set (annotated with @PersistenceContext)
>
> When I'm copying everything from the DAO-jar to the webapp and remove
> the dao-jar from the web-app libs, the entitymanager gets injected as expected.
>
> So, NO ear, NO EJB, just plain CDI with @Inject and the @PersistenceContext.
>
> Does this help?
>
> kr,
> dominik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>