@EJB injection not working - Using Weblogic 10, Myfaces, EJB3
843830Jun 11 2009 — edited Nov 4 2009Good day all
I'm trying to get a simple local reference to a Local EJB using @EJB annotation.
I've read all over the net and tried numerous small changes in an attempt to get this working.
Our Application is packaged as a deploy EAR that holds some util jars and the ejb-jar that houses our beans and interfaces.
// Local Intefrace
@Local
public interface IDataMonitoringService
//Bean implementation
@Stateless(name = "DataMonitoringServiceBean", mappedName = "ejb/DataMonitoringService")
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class DataMonitoringServiceBean3 implements IDataMonitoringService
If this is remote it works fine doing a normal lookup on the JNDI.
The servlet that is trying to inject is like this
Variable in the servlet
@EJB private IDataMonitoringService dataMonitoringService;
in doGet
List<OmDmCategory> list = dataMonitoringService.retriveAllCategories();
On hitting the last line here the dataMonitoringService object is null and injection has not occurred.
I've tried using different names, moving the annotations around on the bean and interfaces... and now I'm really just getting frustrated.
I've tried creating a ServletListener and setting "injected" local instance on the servlet context... but that doesn't inject it either.
My main goal is to be able to use the reference in a Myfaces/JSF bean to retrieve data/update etc.
If someone could help out it would be greatly appreciated.
Thanks
sirAlfred25