[
https://issues.redhat.com/browse/WFLY-14143?page=com.atlassian.jira.plugi...
]
Matěj Novotný commented on WFLY-14143:
--------------------------------------
Hello,
sorry it took me so long to get to this, but other priority items kept popping up.
After testing your reproducer (thanks for that BTW!) I came to a conclusion that this is
actually a configuration error, not a bug. Let's first look into how you make it work
- the MANIFEST file in your WAR needs to declare the following dependency (mind the
meta-inf affix) - {{Dependencies: org.example.mymodule meta-inf}}
This can be achieved via maven war plugin inside your {{MyWar/pom.xml}} in the following
way:
{code:java}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>org.example.mymodule
meta-inf</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
{code}
Your JAR (the library) shouldn't need this declaration.
The fact that it worked in earlier versions of WFLY was actually a bug; one that was
reported and fixed in WFLY-13641. With this fix in place, all deployments now need to
declare that meta-inf dependency if they want to use beans from other deployments (either
via MANIFEST or via jboss-deployment-structure).
All of the above is documented here -
https://docs.wildfly.org/21/Developer_Guide.html#CDI_Reference
Hope this makes it clear, please ask away if that's not the case.
Meanwhile, I will close this issue as it is not a bug.
Can not inject bean from module
-------------------------------
Key: WFLY-14143
URL:
https://issues.redhat.com/browse/WFLY-14143
Project: WildFly
Issue Type: Bug
Components: CDI / Weld, Class Loading
Affects Versions: 21.0.1.Final
Reporter: Mariusz Kulig
Assignee: Matěj Novotný
Priority: Major
Attachments: mymodule.zip, reproduce_sample.zip
Bean from module cannot be injected to bean in deployment. It works properly on
Wildfly 20.0.1.Final but does not work on Wildlfy 21.0.1.Final.
I registered module which contains @ApplicationScoped CDI bean. I tried do deploy WAR
archive that contains library that depends on this module. The library contains proper
entry in Dependencies section in MANIFEST.MF file.
I get exception:
{code:java}
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied
dependencies for type HelloService with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject com.example.mylib.MyLib.helloService
at com.example.mylib.MyLib.helloService(MyLib.java:0)
at
org.jboss.weld.core@3.1.5.Final//org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:378)
{code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)