Currently I am trying to inject a stateless EJB into a CDI managed controller on Jboss 6 AS Final. The controller is managed in the context an accessible from the JSF pages. If I inject the stateless bean with @EJB
it is working. If I inject the stateless EJB with @Inject
I get the following Exception:
My controller:
@Named("TestController")
public class TestController {
@Inject
private TestManagerLocal myTestManager;
...
}
}
My stateless bean:
@SuppressWarnings("unchecked")
@Stateless
public class TestManagerBean implements TestManagerLocal {
@PersistenceContext
private EntityManager em;
...
}
The Interface of the Bean is annotated with @Local.
If I try to call myTestManager I get the following exception:
WELD-000079 Could not find the EJB in JNDI: class de.crud.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$usr$local$jboss$server$default$deploy$test$ear"-SessionBean-TestManagerBean_$$_WeldProxy
THX a lot.
The problem was, that I built and deployed my application as an ear. Weld is working when I deploy my application as an war including all EJBs.