Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0-RC1, 2.3-next-M7
-
None
Description
We're starting work to integration MyFaces 4.0 into the Open Liberty runtime. I've run into the following UnsupportedOperationException:
SRVE9002E: You cannot start this operation from a programmatically added listener when using servlet-3.1 feature. (Operation: getServletRegistrations | Listener: org.apache.myfaces.webapp.StartupServletContextListener | Application: SimpleTest)
Regardless of what the error says Servlet 6.0 is being used so that is not important. In Open Liberty we automatically add the org.apache.myfaces.webapp.StartupServletContextListener programmatically for applications we determine to be "Faces enabled".
Previously we did not have this issue because of the following interface method: https://github.com/apache/myfaces/blob/3.0.x/impl/src/main/java/org/apache/myfaces/spi/WebConfigProvider.java#L50
The method was removed in MyFaces 4.0.0.RC1 and that puts us into the position I'm seeing with the UnsupportedOperationException since according to the Servlet API you can not call getServletRegistrations from a programmatically added listener: