MyFaces Core
  1. MyFaces Core
  2. MYFACES-2434

dummy request/response classes for system event listeners will break with Servlet 3.0

    Details

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

      Description

      Currently the _SystemEventServletRequest and _SystemEventServletResponse classes implement ServletRequest and ServletResponse directly. There are several new methods that must be implemented in the servlet 3.0 updates of those interfaces.

      This can be resolved by changing them to extend ServletRequestWrapper and ServletResponseWrapper instead of implementing directly.

        Issue Links

          Activity

          Hide
          Michael Kurz added a comment -

          There is a bug in the new code. I get a NullPointerException on starting my app because of this code in AbstractFacesInitializer:

          private void dispatchInitDestroyEvent(Object servletContext, Class eventClass) {
          ApplicationFactory appFac = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
          FacesContext fc = null;

          fc = FacesContext.getCurrentInstance();
          ExternalContext ec = fc.getExternalContext();

          if (fc == null) {
          ...

          In my case fc is null!

          Show
          Michael Kurz added a comment - There is a bug in the new code. I get a NullPointerException on starting my app because of this code in AbstractFacesInitializer: private void dispatchInitDestroyEvent(Object servletContext, Class eventClass) { ApplicationFactory appFac = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); FacesContext fc = null; fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); if (fc == null) { ... In my case fc is null!
          Hide
          Michael Concini added a comment -

          reopening to revert the change and re-evaluate the best way to fix this.

          Show
          Michael Concini added a comment - reopening to revert the change and re-evaluate the best way to fix this.
          Hide
          Michael Concini added a comment -

          Thanks to Bernhard Huemer for help in coming up with the final fix.

          Show
          Michael Concini added a comment - Thanks to Bernhard Huemer for help in coming up with the final fix.
          Hide
          Leonardo Uribe added a comment -

          I have this bugs when orchestra for jsf 2.0 is used:

          java.lang.UnsupportedOperationException: This request class is an empty placehol
          der
          at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:55)
          at $Proxy34.getServletPath(Unknown Source)
          at javax.servlet.http.HttpServletRequestWrapper.getServletPath(HttpServletRequestWrapper.java:218)
          at org.apache.myfaces.context.servlet.ServletExternalContextImpl.<init>(ServletExternalContextImpl.java:117)
          at org.apache.myfaces.context.ExternalContextFactoryImpl.getExternalContext(ExternalContextFactoryImpl.java:61)
          at org.apache.myfaces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:130)
          at org.apache.myfaces.webapp.filter.TomahawkFacesContextFactory.getFacesContext(TomahawkFacesContextFactory.java:107)
          at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:70)
          at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.java:93)
          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:138)
          at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)

          GRAVE: An error occured while initializing MyFaces: This request class is an emp
          ty placeholder
          java.lang.UnsupportedOperationException: This request class is an empty placeholder
          at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:55)
          at $Proxy34.getPathInfo(Unknown Source)
          at javax.servlet.http.HttpServletRequestWrapper.getPathInfo(HttpServletRequestWrapper.java:133)
          at org.apache.myfaces.context.servlet.ServletExternalContextImpl.<init>(ServletExternalContextImpl.java:118)
          at org.apache.myfaces.context.ExternalContextFactoryImpl.getExternalContext(ExternalContextFactoryImpl.java:61)
          at org.apache.myfaces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:130)
          at org.apache.myfaces.webapp.filter.TomahawkFacesContextFactory.getFacesContext(TomahawkFacesContextFactory.java:107)
          at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:70)
          at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.jav
          a:93)
          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:138)
          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)

          2009-12-04 14:47:28,234 ERROR org.apache.myfaces.orchestra.lib.jsf.OrchestraFace
          sContextFactory - Problem initialising RequestHandler
          java.lang.UnsupportedOperationException: This request class is an empty placeholder
          at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:55)
          at $Proxy34.getSession(Unknown Source)
          at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:227)
          at org.apache.myfaces.context.servlet.SessionMap.getSession(SessionMap.java:79)
          at org.apache.myfaces.context.servlet.SessionMap.getAttribute(SessionMap.java:49)
          at org.apache.myfaces.util.AbstractAttributeMap.get(AbstractAttributeMap.java:94)
          at org.apache.myfaces.orchestra.frameworkAdapter.jsf.JsfFrameworkAdapter.getSessionAttribute(JsfFrameworkAdapter.java:129)
          at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:127)
          at org.apache.myfaces.orchestra.lib.jsf.ContextLockRequestHandler.init(ContextLockRequestHandler.java:68)
          at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory$1.<init>(OrchestraFacesContextFactory.java:122)
          at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:103)
          at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.java:93)
          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:138)
          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)

          java.lang.NullPointerException
          at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:183)
          at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
          at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140)
          at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:64)
          at org.apache.myfaces.orchestra.viewController.jsf.ViewControllerVariableResolver.resolveVariable(ViewControllerVariableResolver.java:51)
          at org.springframework.web.jsf.DelegatingVariableResolver.resolveOriginal(DelegatingVariableResolver.java:123)
          at org.springframework.web.jsf.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:105)
          at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:96)
          at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
          at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140)
          at org.apache.myfaces.el.VariableResolverToApplicationELResolverAdapter.resolveVariable(VariableResolverToApplicationELResolverAdapter.java:45)
          at org.apache.myfaces.orchestra.frameworkAdapter.jsf.JsfFrameworkAdapter.getBean(JsfFrameworkAdapter.java:177)
          at org.apache.myfaces.orchestra.FactoryFinder.getConversationManagerFactory(FactoryFinder.java:66)
          at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:144)
          at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:99)
          at org.apache.myfaces.orchestra.lib.jsf.ConversationManagerRequestHandler.init(ConversationManagerRequestHandler.java:43)
          at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory$1.(OrchestraFacesContextFactory.java:122)
          at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:103)
          at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.java:93)
          at javax.faces.webapp.FacesServlet.prepareFacesContext(FacesServlet.java:500)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
          at org.apache.myfaces.examples.filter.RequestEncodingFilter.doFilter(RequestEncodingFilter.java:41)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
          at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
          at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
          at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
          at org.mortbay.jetty.Server.handle(Server.java:326)
          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
          at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:915)
          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
          at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

          In few words, the wrappers should use HttpServletXXX for create the proxy (because ServletExternalContextImpl check for it) and contains some dummy methods to make it work. Note RI uses some classes that return null, 0 or empty list/collection when initialization occur. For now, I'll commit only the ones I need.

          Show
          Leonardo Uribe added a comment - I have this bugs when orchestra for jsf 2.0 is used: java.lang.UnsupportedOperationException: This request class is an empty placehol der at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:55) at $Proxy34.getServletPath(Unknown Source) at javax.servlet.http.HttpServletRequestWrapper.getServletPath(HttpServletRequestWrapper.java:218) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.<init>(ServletExternalContextImpl.java:117) at org.apache.myfaces.context.ExternalContextFactoryImpl.getExternalContext(ExternalContextFactoryImpl.java:61) at org.apache.myfaces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:130) at org.apache.myfaces.webapp.filter.TomahawkFacesContextFactory.getFacesContext(TomahawkFacesContextFactory.java:107) at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:70) at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.java:93) 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:138) at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548) GRAVE: An error occured while initializing MyFaces: This request class is an emp ty placeholder java.lang.UnsupportedOperationException: This request class is an empty placeholder at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:55) at $Proxy34.getPathInfo(Unknown Source) at javax.servlet.http.HttpServletRequestWrapper.getPathInfo(HttpServletRequestWrapper.java:133) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.<init>(ServletExternalContextImpl.java:118) at org.apache.myfaces.context.ExternalContextFactoryImpl.getExternalContext(ExternalContextFactoryImpl.java:61) at org.apache.myfaces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:130) at org.apache.myfaces.webapp.filter.TomahawkFacesContextFactory.getFacesContext(TomahawkFacesContextFactory.java:107) at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:70) at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.jav a:93) 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:138) 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) 2009-12-04 14:47:28,234 ERROR org.apache.myfaces.orchestra.lib.jsf.OrchestraFace sContextFactory - Problem initialising RequestHandler java.lang.UnsupportedOperationException: This request class is an empty placeholder at org.apache.myfaces.application._SystemEventServletRequest$1.invoke(_SystemEventServletRequest.java:55) at $Proxy34.getSession(Unknown Source) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:227) at org.apache.myfaces.context.servlet.SessionMap.getSession(SessionMap.java:79) at org.apache.myfaces.context.servlet.SessionMap.getAttribute(SessionMap.java:49) at org.apache.myfaces.util.AbstractAttributeMap.get(AbstractAttributeMap.java:94) at org.apache.myfaces.orchestra.frameworkAdapter.jsf.JsfFrameworkAdapter.getSessionAttribute(JsfFrameworkAdapter.java:129) at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:127) at org.apache.myfaces.orchestra.lib.jsf.ContextLockRequestHandler.init(ContextLockRequestHandler.java:68) at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory$1.<init>(OrchestraFacesContextFactory.java:122) at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:103) at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.java:93) 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:138) 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) java.lang.NullPointerException at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:183) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175) at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140) at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:64) at org.apache.myfaces.orchestra.viewController.jsf.ViewControllerVariableResolver.resolveVariable(ViewControllerVariableResolver.java:51) at org.springframework.web.jsf.DelegatingVariableResolver.resolveOriginal(DelegatingVariableResolver.java:123) at org.springframework.web.jsf.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:105) at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:96) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175) at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140) at org.apache.myfaces.el.VariableResolverToApplicationELResolverAdapter.resolveVariable(VariableResolverToApplicationELResolverAdapter.java:45) at org.apache.myfaces.orchestra.frameworkAdapter.jsf.JsfFrameworkAdapter.getBean(JsfFrameworkAdapter.java:177) at org.apache.myfaces.orchestra.FactoryFinder.getConversationManagerFactory(FactoryFinder.java:66) at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:144) at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:99) at org.apache.myfaces.orchestra.lib.jsf.ConversationManagerRequestHandler.init(ConversationManagerRequestHandler.java:43) at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory$1.(OrchestraFacesContextFactory.java:122) at org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory.getFacesContext(OrchestraFacesContextFactory.java:103) at org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory.getFacesContext(RequestParameterFacesContextFactory.java:93) at javax.faces.webapp.FacesServlet.prepareFacesContext(FacesServlet.java:500) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at org.apache.myfaces.examples.filter.RequestEncodingFilter.doFilter(RequestEncodingFilter.java:41) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:915) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) In few words, the wrappers should use HttpServletXXX for create the proxy (because ServletExternalContextImpl check for it) and contains some dummy methods to make it work. Note RI uses some classes that return null, 0 or empty list/collection when initialization occur. For now, I'll commit only the ones I need.

            People

            • Assignee:
              Michael Concini
              Reporter:
              Michael Concini
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development