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

Unsatisfied dependencies for CDI Beans in static module's dependency

    Details

      Description

      WAR CDI bean is failing to inject a CDI bean from a static module's exported dependency. war -> static module X -> static module Y (containing CDI Beans)

      A WAR uses a static module with the slot attribute. This static module is referenced in jboss-deployment-structure.xml:

      <jboss-deployment-structure> 
         <deployment>
          <dependencies>
            <module name="module2" meta-inf="export" annotations="true" />
          </dependencies>    
          </deployment>    
      </jboss-deployment-structure>
      

      module2 which the app depends on is depending on module1 and including/exporting META-INF where the beans.xml is located:

      <?xml version="1.0"?>
      <module xmlns="urn:jboss:module:1.5" name="module2">
        <dependencies>
          <module name="module1" export="true">
            <imports>
              <include path="META-INF**"/>
              <include path="org**"/>
            </imports>
            <exports>
              <include path="META-INF**"/>
              <include path="org**"/>
            </exports>
          </module>
        </dependencies>
      </module>
      

      module1 contains the jar with the CDI beans and has a META-INF/beans.xml in it:

      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.5" name="module1">
        <resources>
          <resource-root path="cdi-beans.jar"/>
        </resources>
        <dependencies>
          <module name="javax.faces.api" export="true"/>
          <module name="javax.ejb.api"/>
          <module name="javax.enterprise.api"/>
        </dependencies>
      </module>
      

      The deploy fails with the next message:

      14:04:07,085 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."test.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".WeldStartService: Failed to start service
      ...
      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ExampleCdiBean with qualifiers @Default
        at injection point [BackedAnnotatedField] @Inject private backingbeans.BackingBean.cdiBean
        at backingbeans.BackingBean.cdiBean(BackingBean.java:0)
      

      In JBoss EAP 6.4, this scenario, the CDI is working fine.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  manovotn Matej Novotny
                  Reporter:
                  bmaxwell Brad Maxwell
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: