users@glassfish.java.net

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

From: Ludovic Champenois <ludovic.champenois_at_oracle.com>
Date: Sat, 1 May 2010 05:43:36 -0700

Try to put beans.xml under classes/metainf, not under webinf in the
web app,
?
Ludo

On May 1, 2010, at 1:53 AM, Dominik Dorn <dominik.dorn_at_gmail.com> 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
>