Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4442

UnsupportedOperationException when calling getServletRegistrations from initFaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-RC1, 2.3-next-M7
    • 2.3-next-M8, 4.0.0-RC2
    • General
    • 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:

      https://jakarta.ee/specifications/servlet/6.0/apidocs/jakarta.servlet/jakarta/servlet/servletcontext#getServletRegistrations()

       

      Attachments

        Activity

          People

            paul.nicolucci Paul Nicolucci
            paul.nicolucci Paul Nicolucci
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: