]
Matej Novotny reassigned WFLY-9846:
-----------------------------------
Assignee: Matej Novotny (was: Martin Kouba)
Unsatisfied dependencies for CDI Beans in static module's
dependency
--------------------------------------------------------------------
Key: WFLY-9846
URL:
https://issues.jboss.org/browse/WFLY-9846
Project: WildFly
Issue Type: Bug
Components: CDI / Weld
Affects Versions: 11.0.0.Final
Reporter: Brad Maxwell
Assignee: Matej Novotny
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:
{code}
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="module2" meta-inf="export"
annotations="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
{code}
module2 which the app depends on is depending on module1 and including/exporting META-INF
where the beans.xml is located:
{code}
<?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>
{code}
module1 contains the jar with the CDI beans and has a META-INF/beans.xml in it:
{code}
<?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>
{code}
The deploy fails with the next message:
{code}
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)
{code}
In JBoss EAP 6.4, this scenario, the CDI is working fine.