Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4408

NPE with ActionContext.getContext().getSession() / RequestWrapper

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.20
    • 2.3.20
    • Core Actions

    Description

      Since 2.3.18 it happens that I get an NPE when accessing ActionContext.getContext().getSession().

      When i log the Session Map it is printed as "{}" but when calling get() on it, an NPE is thrown. So it is kind of null but not really null ?

      Seems to happen only when no HttpSession is present. The NPE is wrapped in a lot of RuntimeExceptions:

      java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
      	at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:514)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:524)
      	at com.opensymphony.xwork2.inject.ContainerImpl$9.call(ContainerImpl.java:555)
      	at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:584)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:553)
      	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:257)
      	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
      	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
      	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
      	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
      	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
      	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
      	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)
      	at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:600)
      	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:507)
      	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:312)
      	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:385)
      	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:924)
      	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
      	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3837)
      	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
      	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
      	at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
      	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
      	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
      	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
      	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
      	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
      	at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1049)
      	at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:643)
      	at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
      	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
      	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      	at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
      	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
      	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
      	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:502)
      	at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:539)
      	at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:593)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:537)
      	at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)
      	... 40 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)
      	... 45 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
      	at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:469)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:484)
      	at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:34)
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)
      	... 47 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:502)
      	at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:539)
      	at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:593)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:537)
      	at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)
      	... 52 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)
      	... 57 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
      	at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:469)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:484)
      	at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:34)
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)
      	... 59 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:502)
      	at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:539)
      	at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:593)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:537)
      	at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)
      	... 64 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)
      	... 69 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
      	at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:469)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:484)
      	at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:34)
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)
      	... 71 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:502)
      	at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:539)
      	at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:593)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:537)
      	at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)
      	... 76 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)
      	... 81 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
      	at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:469)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:484)
      	at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:34)
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)
      	... 83 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:502)
      	at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:539)
      	at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:593)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:537)
      	at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)
      	... 88 more
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)
      	at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)
      	... 93 more
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
      	at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:469)
      	at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:484)
      	at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:34)
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)
      	... 95 more
      Caused by: java.lang.NullPointerException
            my.class.accessing.SessionMap
      

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            cn42 Christoph Nenning
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: