I have created separate JAR archive with my session beans that I use in multiple seam web projects. However, when I try to use it, entity manager defined in the session bean is always null :(
I declare entity manager in my
outside session beans like this:
@PersistenceContext(unitName="UnitName") private EntityManager entityManager;
Then I try to instantiate in my seam project in multiple ways:
@In OutsideBean bean; @EJB(name="beanName") OutsideBean bean; or simply OutsideBean bean = new OutsideBean();
All the time entityManager variable is null and I can't operate on data from database.
I've been stuck with this for 3 days now, google, searching forums gives me no hints. Perhaps here anyone could give me a hint? At least a clue, if it's seam or my jar archive related problem. Persistence unit is declared in another JAR - with entity beans. However seam projects as well as message driven beans (also separare jar archive) can use it without problems. My guess is I instate the SLSB in the wrong way...
My archives structure in the server looks like this: