Wildfly + CDI injection of Servlets, Filters, and Listeners

39 views
Skip to first unread message

Ryan Lubke

unread,
Jul 10, 2024, 5:35:44 PMJul 10
to WildFly
Hey folks,

I've been working on validating injection within my web application that works fine in Tomcat 10.x and Jetty 12.

This application has been re-processed in order to wrap each Servlet, Filter, and Listener
in order to expose features used by our project.  The wrapper then takes responsibility for instantiating and delegating calls to the wrapped object.  The wrapper relies on calling ServletContext.create{Servlet,Filter,Listener} to instantiate and inject the actual object (the javadocs seem to cover this use-case)

In this case, the Servlet is packaged in a JAR and included in WEB-INF/lib and has a beans.xml in its META-INF directory.  I've also included a beans.xml in WEB-INF based on some threads I've read, but this hasn't made any difference; the object returned from the ServletContext call isn't injected.

I do see weld-related messages in the log:

[org.jboss.weld.deployer] (MSC service thread 1-7) WFLYWELD0003: Processing weld deployment web.war
[org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900: 5.1.0 (Final)

Nothing else really stands out (no errors to speak of)

I'm hoping someone can confirm whether I'm hitting a bug in Wildfly or have I missed some bit of configuration somewhere?

Versions:
  • Wildfly 27.0.1
  • JDK 21.0.3
 

Bartosz Baranowski

unread,
Jul 11, 2024, 9:48:01 AMJul 11
to WildFly
Looks kind of specific, would it be possible for you to cook up some reproducer?

Ryan Lubke

unread,
Jul 11, 2024, 1:21:05 PMJul 11
to WildFly
Sure, I'll get one to you in the next couple of days.
Reply all
Reply to author
Forward
0 new messages