Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-2846

MyFaces AUTOMATIC_EXTENSIONLESS_MAPPING doesnt work

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 8.0.2
    • Fix Version/s: None
    • Component/s: TomEE Core Server
    • Labels:
      None

      Description

      MyFaces has a feature to automatically serve all views without extension/suffix:
      index.xhtml -> index

      this is implemented in the AbstractFacesInitializer and can be activated via:
      org.apache.myfaces.AUTOMATIC_EXTENSIONLESS_MAPPING = true

      This currently throws the following exception:

      java.lang.UnsupportedOperationException: Section 4.4 of the Servlet 3.0 specification does not permit this method to be called from a ServletContextListener that was not defined in web.xml, a web-fragment.xml file nor annotated with @WebListener
      	at org.apache.catalina.core.StandardContext$NoPluggabilityServletContext.getServletRegistrations(StandardContext.java:6579)
      	at org.apache.myfaces.webapp.AbstractFacesInitializer.getFacesServletRegistration(AbstractFacesInitializer.java:834)
      	at org.apache.myfaces.webapp.AbstractFacesInitializer.initAutomaticExtensionlessMapping(AbstractFacesInitializer.java:820)
      	at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:246)
      	at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:103)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4683)
      

      It actually works without TomEE on plain Tomcat, as MyFaces adds the StartupServletContextListener via his own web-fragment in the myfaces-impl jar.
      This is not scanned in TomEE and the StartupServletContextListener is added manually in:

      https://github.com/apache/tomee/blob/master/tomee/tomee-myfaces/src/main/java/org/apache/tomee/myfaces/TomEEMyFacesContainerInitializer.java#L96

      Could we fix it by fake it in Tomcat somehow, that the listener was added via XML?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tandraschko Thomas Andraschko
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: