upgrading from wildfly 10.1 to 20 - WFLYWELD0037

164 views
Skip to first unread message

Jens Viebig

unread,
Jun 30, 2020, 3:59:59 PM6/30/20
to WildFly
We are trying to migrate an application from wildfly 10.1 to 20

It consists of a core ear deployment and some wars depending on the modules deployed in the ear.
The core ear is a mixed CDI/EJB deployment.
We did NOT use CDI across the modules which was not fully supported and this was Ok for us.

So newer wildfly allowsCDI across modules, but that gets us in trouble

Our application still works upgrading to wildfly 12, but from wildfly 13+, wildfly insists in importing everything as CDI beans from the core ear to the war, trying to create new instances of the ejb and cdi beans.

We get an exception on deployment of the war:
Caused by: java.lang.IllegalArgumentException: WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named '' in deployment mywar.war for injection point javax.persistence.EntityManager com.somecompany.SomeEJBBean.em

Basically we are struggling with the same issue described here

We already had some fun with shared classes loaded from different jars so i'm not sure the described workaround in the link is the best solution

We already tried excludes in beans.xml without effect
We do NOT use meta-inf import which is decribed to enable cross-module-CDI

Is there another way on stopping wildfly from importing CDIs from imported modules ?
What changed from wildfly 12 to 13 which breaks our application ?




Jens Viebig

unread,
Jul 1, 2020, 9:43:43 AM7/1/20
to WildFly

Did not find a solution for this for quite some time, but got a step further today

Some things that worked (sort of...)

- Excluding ejb session beans via @Vetoed annotation
- beans.xml scan excludes in the core ear (we tried excludes in the war without an effect)

But these approaches also stopped @Inject to work internally in the core ear for EJBs, so CDIs using EJBs internally stopped working and broke the application in a different way.


So now the most promising approach is setting beans.xml to "annotated" mode inside the core ejb-jar/ear:
<?xml version="1.0" encoding="UTF-8"?>
    bean-discovery-mode="annotated" version="2.0">
</beans>

and annotate all beans that shoud be able to be injected with at least @Dependent scope annotation

Playing with a small test application, whats interesting, that this completely stops cross-module cdi injection, which is Ok for us, but somehow surprising.
Would have thought that annotated beans then could also be possible to @Inject in the war

Jens Viebig

unread,
Jul 6, 2020, 2:53:09 AM7/6/20
to WildFly
Our current "solution" produces lots of warnings about classes not being  able to be indexed so we are not sure if our solution only works "by accident", see:
https://issues.redhat.com/browse/WFLY-13641
Reply all
Reply to author
Forward
0 new messages