Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-14233

[GSS](7.1.z) Bean discovery in deployment dependencies (modules) is always interpreted as "all" and fails to inject from static module's exported dependency

XMLWordPrintable

    • Hide

      Have the application depend on module1 which contains the actual jar as a workaround

      Show
      Have the application depend on module1 which contains the actual jar as a workaround

      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.

        1. test-overlay-eap71.zip
          11 kB
        2. test-overlay-eap64.zip
          11 kB
        3. server.log
          21 kB
        4. reproducer2.zip
          19 kB

              spyrkob Bartosz Spyrko-Smietanko
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: