null EntityManager while calling an EJB from an EJB.

ROUMEAS MicaĆ«l <[email protected]> Tue, 01 Mar 2011 09:46:46 +0000
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
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.