users@glassfish.java.net

Re: CDI broken between EJB and JPA modules

From: <glassfish_at_javadesktop.org>
Date: Tue, 01 Jun 2010 06:51:55 PDT

Hi,
I just wanted to add our experience with this issue (quoted my entry from the bug db
https://glassfish.dev.java.net/issues/show_bug.cgi?id=11769):

"We have the same issue in our application with the same module and library
structure (except that our EJBs are not exposed as WebService).
Trying to create an SLSB that has the DAO injected fails at exactly the same
location. It even fails as soon as we turn on CDI (see below).

One thing we noticed:

Our SLSB was in the very beginning using JPA like this:
@PersistenceContext EnitityManager em;
This worked fine in GF 3.0.1, build 19. At that time, we did not have the file
META-INF/beans.xml in the EJB module.
Then, we wanted to get the DAO classes (which have the injected EntityManager
reference) injected via CDI and added the required META-INF/beans.xml to the EJB
module.
Immediately after doing this, we get the described behavior even without trying
to inject anything via CDI. Looks like enabling CDI changes the container
strategy to inject JPA resources (WELD?) and that is not working."

I am really surprised that this has not come up before, since it represents in my opinion a typical use case for using EJB, JPA and CDI in a middletier layer. Is nobody using this?

Thanks, jhasenbe
[Message sent by forum member 'jhasenbe']

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