Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-19981

[GSS](7.3.z) JSF deployment failure due to UnsupportedOperationException when javax.faces.FACELETS_VIEW_MAPPINGS is defined

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.3.5.GA, 7.3.5.CR1
    • 7.3.1.GA
    • JSF, Undertow
    • None
    • +
    • Workaround Exists
    • Hide

      Add "*.xhmtl;" to the javax.faces.FACELETS_VIEW_MAPPINGS setting. For example:

          <context-param>
              <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
              <param-value>*.xhmtl;*.jsp</param-value>
          </context-param>
      
      Show
      Add "*.xhmtl;" to the javax.faces.FACELETS_VIEW_MAPPINGS setting. For example: <context-param> <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name> <param-value>*.xhmtl;*.jsp</param-value> </context-param>
    • Hide

      1. Configure the following javax.faces.FACELETS_VIEW_MAPPINGS setting in web.xml of your JSF application (For example, add the following web.xml to tasks-jsf in JBoss EAP QuickStarts):

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"                  
               version="4.0">
          <context-param>
              <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
              <param-value>*.jsp</param-value>
          </context-param>
      </web-app>
      

      2. Deploy the application and start JBoss EAP 7.3

      3. You will see the deployment failure due to "UnsupportedOperationException: UT010042: This method cannot be called from a servlet context listener that has been added programmatically"

      Show
      1. Configure the following javax.faces.FACELETS_VIEW_MAPPINGS setting in web.xml of your JSF application (For example, add the following web.xml to tasks-jsf in JBoss EAP QuickStarts): <?xml version= "1.0" encoding= "UTF-8" ?> <web-app xmlns= "http: //xmlns.jcp.org/xml/ns/javaee" xmlns:xsi= "http: //www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http: //xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version= "4.0" > <context-param> <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name> <param-value>*.jsp</param-value> </context-param> </web-app> 2. Deploy the application and start JBoss EAP 7.3 3. You will see the deployment failure due to "UnsupportedOperationException: UT010042: This method cannot be called from a servlet context listener that has been added programmatically"

      When the following setting is defined in web.xml for JSF application:

          <context-param>
              <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
              <param-value>*.jsp</param-value>
          </context-param>
      

      JSF deployment fails with "UnsupportedOperationException: UT010042: This method cannot be called from a servlet context listener that has been added programmatically"

      SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 84) Critical error during deployment: : 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:976)
      	at io.undertow.servlet.spec.ServletContextImpl.getServletRegistrations(ServletContextImpl.java:584)
      	at com.sun.faces.util.Util.getExistingFacesServletRegistration(Util.java:160)
      	at com.sun.faces.util.Util.getFacesServletMappings(Util.java:150)
      	at com.sun.faces.util.Util.isResourceExactMappedToFacesServlet(Util.java:1158)
      	at com.sun.faces.util.Util.isViewIdExactMappedToFacesServlet(Util.java:1139)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.handlesViewId(FaceletViewHandlingStrategy.java:946)
      	at com.sun.faces.application.view.ViewHandlingStrategyManager.getStrategy(ViewHandlingStrategyManager.java:76)
      	at com.sun.faces.application.view.ViewDeclarationLanguageFactoryImpl.getViewDeclarationLanguage(ViewDeclarationLanguageFactoryImpl.java:47)
      	at com.sun.faces.application.view.MultiViewHandler.getViewDeclarationLanguage(MultiViewHandler.java:446)
      	at javax.faces.application.ViewHandlerWrapper.getViewDeclarationLanguage(ViewHandlerWrapper.java:346)
      	at javax.faces.application.ViewHandlerWrapper.getViewDeclarationLanguage(ViewHandlerWrapper.java:346)
      	at com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.processEvent(ApplicationAssociate.java:324)
      	at javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)
      	at com.sun.faces.application.applicationimpl.Events.processListeners(Events.java:253)
      	at com.sun.faces.application.applicationimpl.Events.invokeListenersFor(Events.java:231)
      	at com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:112)
      	at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
      	at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
      	at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:553)
      	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:264)
      	at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
      	at io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:217)
      	at io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:186)
      	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:42)
      	at io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43)
      	at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create(SecurityContextThreadSetupAction.java:105)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:78)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.lang.Thread.run(Thread.java:748)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:491)
      
      ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 84) MSC000001: Failed to start service jboss.deployment.unit."tasks-jsf.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."tasks-jsf.war".undertow-deployment: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: UT010042: This method cannot be called from a servlet context listener that has been added programatically
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:81)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.lang.Thread.run(Thread.java:748)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:491)
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: UT010042: This method cannot be called from a servlet context listener that has been added programatically
      	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:254)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:78)
      	... 8 more
      Caused by: java.lang.RuntimeException: java.lang.UnsupportedOperationException: UT010042: This method cannot be called from a servlet context listener that has been added programatically
      	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:283)
      	at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
      	at io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:217)
      	at io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:186)
      	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:42)
      	at io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43)
      	at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create(SecurityContextThreadSetupAction.java:105)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create(UndertowDeploymentInfoService.java:1541)
      	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252)
      	... 10 more
      Caused by: 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:976)
      	at io.undertow.servlet.spec.ServletContextImpl.getServletRegistrations(ServletContextImpl.java:584)
      	at com.sun.faces.util.Util.getExistingFacesServletRegistration(Util.java:160)
      	at com.sun.faces.util.Util.getFacesServletMappings(Util.java:150)
      	at com.sun.faces.util.Util.isResourceExactMappedToFacesServlet(Util.java:1158)
      	at com.sun.faces.util.Util.isViewIdExactMappedToFacesServlet(Util.java:1139)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.handlesViewId(FaceletViewHandlingStrategy.java:946)
      	at com.sun.faces.application.view.ViewHandlingStrategyManager.getStrategy(ViewHandlingStrategyManager.java:76)
      	at com.sun.faces.application.view.ViewDeclarationLanguageFactoryImpl.getViewDeclarationLanguage(ViewDeclarationLanguageFactoryImpl.java:47)
      	at com.sun.faces.application.view.MultiViewHandler.getViewDeclarationLanguage(MultiViewHandler.java:446)
      	at javax.faces.application.ViewHandlerWrapper.getViewDeclarationLanguage(ViewHandlerWrapper.java:346)
      	at javax.faces.application.ViewHandlerWrapper.getViewDeclarationLanguage(ViewHandlerWrapper.java:346)
      	at com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.processEvent(ApplicationAssociate.java:324)
      	at javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)
      	at com.sun.faces.application.applicationimpl.Events.processListeners(Events.java:253)
      	at com.sun.faces.application.applicationimpl.Events.invokeListenersFor(Events.java:231)
      	at com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:112)
      	at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
      	at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
      	at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:553)
      	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:264)
      	... 22 more
      

      The same application can be deployed on EAP 7.1.6, but this deployment failure happens since EAP 7.2.0 onwards.

              rchakrab Ranabir Chakraborty
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: