2 Replies Latest reply on May 20, 2014 4:27 AM by Martin Kouba

    WELD-001408: Unsatisfied dependencies when moving @Produces method to a different module

    Jens Koefod Hansen Newbie

      Hi, I'm a beginner with CDI so I'm probably overlooking something obvious.


      I have a qualifier annotation and an @Produces method to inject system properties into fields in an EJB implemetation. When these classes are in the same EAR/jar as the injection itself it works, but when I move it to a separate EAR (so I can use it from all EARs) I get the following error:


      WELD-001408 Unsatisfied dependencies for type [String] with qualifiers [@Config] at injection point [[field] @Config @Inject private com.one.myappl.ejb.session.myappl.MyFacadeEJB.serverInMails]


      Both the defineing jar (shared-utils.ear/common-utils.jar) and the EJB implementation (myappl.ear/myappl-ejb-impl.jar) contain beans.xml with only the root element.


      jboss-deployment-structure.xml in myappl.ear declares a dependency on shared-utils:


            <module name="deployment.sharedutils.ear" export="true" />


      Here is the simplified code


      // Config.java in shared-utils.ear/common-utils.jar
      public @interface Config {


      // ConfigurationFactory.java in shared-utils.ear/common-uils.jar
      public class ConfigurationFactory {
          public @Produces @Config String getStringConfiguration(InjectionPoint p) {
              return "myserver"; // Should look up the system property based on p


      // Facade class in myappl.ear/myappl-ejb-impl.jar
      public class MyFacadeEJB implements MyFacade {
          @Inject @Config
          private String serverInMails;