[jboss-user] [EJB 3.0] - Re: EntityManager Null when trying to inject into stateless

BmanT do-not-reply at jboss.com
Wed Apr 25 14:41:01 EDT 2007


Here is an update:

I was able to inject the PersistenceContext into my session bean by retrieving the LocalInterface class from the InitialContext within my web service java class.


  | SampleClass sc = null;
  | InitialContext ic = new InitialContext();
  | sc = (ISampleClass)ic.lookup("MyEar/SampleClass/local");
  | 

I tried injecting the EJB at the class level - but that was always null.


  | @EJB (mappedName="MyEar/SampleClass/local")
  | SampleClass sc;
  | 

I also tried just setting the mapped name to: SampleClass, MyEar/SampleClass and a bunch of other things - but none of them worked.

Is this the optimal solution to get my web service an instance of my stateless session bean from the container?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040715#4040715

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040715



More information about the jboss-user mailing list