MyFaces Core
  1. MyFaces Core
  2. MYFACES-2520

UnsupportedOperationException when launching Trinidad 2 w/ MyFaces2 in Jetty

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-beta-2
    • Fix Version/s: 2.0.0-beta-2
    • Component/s: JSR-314
    • Labels:
      None

      Description

      SEVERE:
      java.lang.UnsupportedOperationException: This request class is an empty placeholder
      at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:56)
      at $Proxy0.getContentType(Unknown Source)
      at javax.servlet.ServletRequestWrapper.getContentType(ServletRequestWrapper.java:145)
      at org.apache.myfaces.context.servlet.ServletExternalContextImpl.getRequestContentType(ServletExternalContextImpl.java:322)
      at org.apache.myfaces.trinidad.util.ExternalContextUtils.getContentType(ExternalContextUtils.java:341)
      at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler.isMultipartRequest(MultipartFormHandler.java:57)
      at org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl.beginRequest(FileUploadConfiguratorImpl.java:109)
      at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._startConfiguratorServiceRequest(GlobalConfiguratorImpl.java:532)
      at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:211)
      at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.getExternalContext(GlobalConfiguratorImpl.java:327)
      at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$CacheRenderKit.<init>(FacesContextFactoryImpl.java:90)
      at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:68)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.dispatchInitDestroyEvent(AbstractFacesInitializer.java:140)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:109)
      at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:155)
      at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
      at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:224)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
      at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
      at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
      at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
      at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Jan 29, 2010 11:38:07 AM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
      SEVERE: An error occured while initializing MyFaces: This request class is an empty placeholder
      java.lang.UnsupportedOperationException: This request class is an empty placeholder
      at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:56)
      at $Proxy0.getHeader(Unknown Source)
      at javax.servlet.http.HttpServletRequestWrapper.getHeader(HttpServletRequestWrapper.java:91)
      at org.apache.myfaces.trinidadinternal.context.external.ServletRequestHeaderMap.getAttribute(ServletRequestHeaderMap.java:42)
      at org.apache.myfaces.trinidadinternal.context.external.ServletRequestHeaderMap.getAttribute(ServletRequestHeaderMap.java:30)
      at org.apache.myfaces.trinidadinternal.context.external.AbstractAttributeMap.get(AbstractAttributeMap.java:73)
      at org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit.isAjaxRequest(CoreRenderKit.java:148)
      at org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit.isPartialRequest(CoreRenderKit.java:163)
      at org.apache.myfaces.trinidadinternal.config.xmlHttp.XmlHttpConfigurator.getExternalContext(XmlHttpConfigurator.java:61)
      at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.getExternalContext(GlobalConfiguratorImpl.java:351)
      at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$CacheRenderKit.<init>(FacesContextFactoryImpl.java:90)
      at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:68)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.dispatchInitDestroyEvent(AbstractFacesInitializer.java:140)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:109)
      at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:155)
      at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
      at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:224)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
      at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
      at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
      at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
      at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

        Issue Links

          Activity

          Hide
          Leonardo Uribe added a comment -

          The proposed solution works, so we can close this issue

          Show
          Leonardo Uribe added a comment - The proposed solution works, so we can close this issue
          Hide
          Leonardo Uribe added a comment -

          Committed proposed solution

          Show
          Leonardo Uribe added a comment - Committed proposed solution
          Hide
          Leonardo Uribe added a comment -

          I think the solution is change _SystemEventServletRequest and _SystemEventServletResponse with dummy methods (returning null, -1, false or empty arrays or collections) to all methods. For example, the code in trinidad check for null on getContentType, so we can return null safely. I remember this same problem with myfaces orchestra for jsf 2.0 and the solution was add dummy methods too. The problem is define what should we return for.

          Show
          Leonardo Uribe added a comment - I think the solution is change _SystemEventServletRequest and _SystemEventServletResponse with dummy methods (returning null, -1, false or empty arrays or collections) to all methods. For example, the code in trinidad check for null on getContentType, so we can return null safely. I remember this same problem with myfaces orchestra for jsf 2.0 and the solution was add dummy methods too. The problem is define what should we return for.
          Show
          Jakob Korherr added a comment - There already was a discussion about that on the mailing list: http://old.nabble.com/problem-using-myfaces-core-2.0.0-SNAPSHOT-%2B-myfaces-orchestra20-1.5-SNAPSHOT-td27239462.html#a27239462
          Hide
          Werner Punz added a comment - - edited

          Ok another analysis, trinidad probably uses the system event, but that one is called outside of any real request (understandable since the destroy etc... is request independend) and then tries to determine the request content type, then runs into this issue, unfortunately.

          One solution would be to delegate what is possible to the servlet context object
          so that we at least can cover parts of the servlet functionality, or simply return a default value (null?) here.

          In this case calling getRequestContentType is questionable since we dont even have a request here since we still are in the init part of the system.

          It would be interesting to see how the RI behaves in this case so that we have the same behavior here.. This is definitely one shady area of the source where we should absolutely behave the same as the RI.

          Show
          Werner Punz added a comment - - edited Ok another analysis, trinidad probably uses the system event, but that one is called outside of any real request (understandable since the destroy etc... is request independend) and then tries to determine the request content type, then runs into this issue, unfortunately. One solution would be to delegate what is possible to the servlet context object so that we at least can cover parts of the servlet functionality, or simply return a default value (null?) here. In this case calling getRequestContentType is questionable since we dont even have a request here since we still are in the init part of the system. It would be interesting to see how the RI behaves in this case so that we have the same behavior here.. This is definitely one shady area of the source where we should absolutely behave the same as the RI.
          Hide
          Werner Punz added a comment - - edited

          Ok the problem here is we basically use an empty proxy here for the request and response object, because we are outside of any request here.
          The problem here probably is that the invoke of the proxy simply does too much...
          or too few, it throws an exception because the class itself is a placeholder... perfectly viable
          but if the system calls something on the request the invoke is automatically invoked throwing the error.

          Both things perfectly viable but both things in combination cause the error.

          What we either do is simply to replace the shell causing the error with an interface implementation
          which does nothing
          or we cover it from the outside aka HttpServletRequestWrapper.

          Show
          Werner Punz added a comment - - edited Ok the problem here is we basically use an empty proxy here for the request and response object, because we are outside of any request here. The problem here probably is that the invoke of the proxy simply does too much... or too few, it throws an exception because the class itself is a placeholder... perfectly viable but if the system calls something on the request the invoke is automatically invoked throwing the error. Both things perfectly viable but both things in combination cause the error. What we either do is simply to replace the shell causing the error with an interface implementation which does nothing or we cover it from the outside aka HttpServletRequestWrapper.

            People

            • Assignee:
              Leonardo Uribe
              Reporter:
              Matthias Weßendorf
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development