Re: null EntityManager while calling an EJB from an EJB.

"Hans J. Prueller" <[email protected]> Tue, 01 Mar 2011 10:53:29 +0100
Newsgroups gmane.comp.java.objectweb.jonas
Organization LBS logics GmbH
Message-ID <1298973209.1862.3.camel@smithers>
I cannot really help you but I would strongly suggest  that you upgrade
to the latest 5.2M4 !

We are using 5.2M4 with same scenario as you do - several SLSB's
"linked" to each other with @EJB annotations and all of the EJB's
are having an injected entityManager with @PersistenceContext and this
works pretty fine for us! 

regards,
Hans

Am Dienstag, den 01.03.2011, 09:46 +0000 schrieb ROUMEAS Micaƫl:

> Hi there,
> 
> I'm actually using JOnAS 5.2.M3 and I have an issue with my EJBs.
> 
> I'm trying to use an EJB from another EJB, and so far the link "EJB to 
> EJB" is working properly.
> My issue come when my second EJB try to use an EntityManager:
>      @PersistenceContext
>      private EntityManager em = null;
> 
>      ...
> 
>      em.find( myClass.class, "findMe" );
> 
> 
> The "em" is null, JOnAS crash with a null pointer exception here.
> 
> I don't understand why. Because when I call my EJB from a servlet for 
> example, my entity manager "em" is not null.
> "em" is null only if I call my EJB from another EJB from the same package.
> 
> Is there any reason for this ? Or do I miss understood some basics ?
> 
> I hope my problem is clearly explained.
> Any clue or question will be more than welcome.
> 
> Thanks for your time,
> M Roumeas.
> 
>