Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-1620

EJB in CDI enabled module gets registered twice leading to WELD-001409 Ambiguous dependencies...

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.0.0.Alpha3
    • 8.0.0.Alpha2
    • Server
    • None

    Description

      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

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            rhn-support-bmaxwell Brad Maxwell
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: