Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-899

Jakarta 9+ fails with Shiro native sesions

    XMLWordPrintableJSON

Details

    Description

      Integration test with Shiro-native session fails with the below stack trace.

      HttpSessionContext is deprecated in Servlet 3.x and now removed in Servlet 5.x+

      Things tried to fix:

      • Remove the deprecated methods (failed because the old interface remains unimplemented - compile error)
      • Created an empty interface that inherits from HttpSessionContext (failed test because the old interface is still referenced)
      • Add a shim for Jakarta Servlet (empty HttpSessionContext interface) - Worked

      The failing tests will be introduced as part of the EE integration package in SHIRO-898 (tests already exist there)

       

      ----- Root Cause -----
      java.lang.NoClassDefFoundError: jakarta/servlet/http/HttpSessionContext
      	at org.apache.shiro.web.servlet.ShiroHttpServletRequest.getSession(ShiroHttpServletRequest.java:159)
      	at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:143)
      	at jakarta.faces.context.ExternalContextWrapper.getSession(ExternalContextWrapper.java:483)
      	at jakarta.faces.context.ExternalContextWrapper.getSession(ExternalContextWrapper.java:483)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.getSession(FaceletViewHandlingStrategy.java:1865)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:405)
      	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:162)
      	at jakarta.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:125)
      	at jakarta.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:125)
      	at org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:151)
      	at jakarta.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:125)
      	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:93)
      	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72)
      	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:178)
      	at jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:692)
      	at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:449)
      	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1569)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:331)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
      	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
      	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
      	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
      	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
      	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
      	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
      	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
      	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
      	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
      	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:458)
      	at com.flowlogix.shiro.ee.filters.ShiroFilter.executeChain(ShiroFilter.java:239)
      	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:373)
      	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
      	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
      	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:388)
      	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:370)
      	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
      	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:816)
      	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
      	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:527)
      	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:497)
      	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:379)
      	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:504)
      	at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:693)
      	at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:384)
      	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:318)
      	at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:216)
      	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:379)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:239)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:174)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:153)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:196)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: java.lang.ClassNotFoundException: jakarta.servlet.http.HttpSessionContext
      	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1843)
      	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1684)
      	... 68 more
      ]]

       

      Attachments

        Issue Links

          Activity

            People

              lprimak Lenny Primak
              lprimak Lenny Primak
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m