Closed larsgrefer closed 9 months ago
When using Undertow instead of Tomcat, the error looks like this:
2023-09-30T02:09:07.305+02:00 WARN 65537 --- [ Test worker] org.jboss.weld.Bootstrap : WELD-ENV-000028: Weld initialization skipped - no bean archive found
2023-09-30T02:09:07.320+02:00 WARN 65537 --- [ Test worker] j.e.r.webcontainer.faces.application : Weld skipped initialization - forcing it to reinitialize
2023-09-30T02:09:07.321+02:00 WARN 65537 --- [ Test worker] j.e.r.webcontainer.faces.application : Reinitializing Weld failed - giving up, please make sure your project contains at least one bean class with a bean defining annotation and retry
java.lang.UnsupportedOperationException: UT010042: This method cannot be called from a servlet context listener that has been added programatically
at io.undertow.servlet.spec.ServletContextImpl.ensureNotProgramaticListener(ServletContextImpl.java:1018) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at io.undertow.servlet.spec.ServletContextImpl.setInitParameter(ServletContextImpl.java:439) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at com.sun.faces.util.Util.getCdiBeanManager(Util.java:1484) ~[jakarta.faces-4.0.4.jar:4.0.4]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:124) ~[jakarta.faces-4.0.4.jar:4.0.4]
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:219) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:187) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:255) ~[undertow-servlet-2.3.8.Final.jar:2.3.8.Final]
at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.createManager(UndertowServletWebServerFactory.java:329) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.getWebServer(UndertowServletWebServerFactory.java:298) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:602) ~[spring-context-6.1.0-M5.jar:6.1.0-M5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-3.2.0-M3.jar:3.2.0-M3]
Right. I initially invoked it in FacesInitializer
, but then I stumbled upon a race condition which caused this all to fail when Weld initializer is invoked after Faces initialier. There is no defined order in how ServletContainerInitialier
instances are invoked. So I moved it to ConfigureListener
last moment but this indeed doesn't anymore work that way. I'll have to further improve this.
PR created ^^. This time I retested.
I only wish adding tests is easier. Since move of Mojarra specific tests to TCK I cannot anymore add new (automated!) tests specifically for bugfix versions.
Since move of Mojarra specific tests to TCK I cannot anymore add new (automated!) tests specifically for bugfix versions.
That should still be possible, but only need to be done in the .Next version of the TCK. So e.g. currently not for the 4.0.x series TCK.
Sure but they are not executed during PRs.
Merged into 4.0: https://github.com/eclipse-ee4j/mojarra/pull/5324 Merged 4.0 into 4.1: https://github.com/eclipse-ee4j/mojarra/commit/9934c0f7cfb5765acc17f564e4628f1c9d985759 Merged 4.1 into 5.0: https://github.com/eclipse-ee4j/mojarra/commit/967a9e75302498a071996e005d864e26503c6869
Describe the bug
5238 introduces a "hack" in order to force Weld to initialize as explained in https://github.com/eclipse-ee4j/mojarra/issues/5232#issuecomment-1555916766
When trying to use this fallback mechanism, I get the following error:
Additional context
Mojarra 4.0.4 on an embedded Tomcat 10.1.13
The
ConfigureListener
is not allowed to callServletContext#setInitParameter
as it was registered programmatically bycom.sun.faces.config.FacesInitializer