Description of problem: If you have this no-interface @Stateless EJB in the module and have a beans.xml inside the module jar as well and then have a deployment depends on & imports the annotations, and then uses @Inject TestEjb, Weld will complain that there are two options an EJB and a ManagedBean and it doesn't know which to inject. According to [1] it should only be considered a managed bean if "It is not annotated with an EJB component-defining annotation or declared as an EJB bean class in ejb-jar.xml ." The error: WELD-001409 Ambiguous dependencies for type [TestEjb] with qualifiers [@Default] at injection point [[field] @Inject test.webapp.TestService.testEjb]. Possible dependencies [[Session bean [class test.TestEjb with qualifiers [@Any @Default]; local interfaces are [TestEjb], Managed Bean [class test.TestEjb] with qualifiers [@Any @Default]]] @Stateless public class TestEjb { public String hello() { return "Hello"; } } If I move all of the classes into the test war, then Weld doesn't have an issue, so it seems there is some difference when the code is put into the modules directory. [1] http://docs.jboss.org/weld/reference/1.0.1-Final/en-US/html_single/#d0e792 How reproducible: Steps to Reproduce: 1. put a no-interface view EJB into a jar, include a beans.xml in the jar to make it CDI enabled. 2. Run jandex to generate a jandex index for the annotations. 3. Put the jar into a custom module in $JBOSS_HOME/modules/ 4. Deploy a test.war that tries to inject using @Inject and depends on the custom module via module dependencies with meta-inf=import and annotations=true Actual results: Deployment fails as there are two options for injection: EJB & CDI bean. Workaround change @Inject to @EJB WELD-001409 Ambiguous dependencies for type [TestEjb] with qualifiers [@Default] at injection point [[field] @Inject test.webapp.TestService.testEjb]. Possible dependencies [[Session bean [class test.TestEjb with qualifiers [@Any @Default]; local interfaces are [TestEjb], Managed Bean [class test.TestEjb] with qualifiers [@Any @Default]]] Expected results: EJB is registered as an EJB only , not a CDI module. @Inject on the no-interface view of the EJB results in the EJB being injected Additional info:
relevant 6.2 PR: https://github.com/jbossas/jboss-eap/pull/345