Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6481

NullPointerException in MountedMapper

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.0.0-M7, 7.9.0
    • Fix Version/s: 8.0.0-M8, 7.10.0
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Linux 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u5 (2017-09-19) x86_64 GNU/Linux
      Java 8u144
      Tomcat 9.0.1

      Description

      In case users open bookmarked deep links (including page version) or the page currently displayed expired, in some cases there are NPEs in the MountedMapper:

      09:48:55,229-[ajp-nio-8154-exec-6] ERROR -ErrorPage           - java.lang.NullPointerException
      	at org.apache.wicket.core.request.mapper.MountedMapper.checkPageClass(MountedMapper.java:256)
      	at org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.mapHandler(AbstractBookmarkableMapper.java:400)
      	at org.apache.wicket.core.request.mapper.MountedMapper.mapHandler(MountedMapper.java:154)
      	at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:210)
      	at org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:449)
      	at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:186)
      	at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:202)
      	at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:912)
      	at org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:65)
      	at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:283)
      	at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:253)
      	at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:221)
      	at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:262)
      	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:204)
      	at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:286)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:230)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at de.bps.blok.utils.NoJSessionIdInUrlFilter.doFilter(NoJSessionIdInUrlFilter.java:44)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      	at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:844)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:745)
      

      Reason seems to be in PageProvider.getPageClass(). This may return null if hasPageInstance() returns false. In that case a NPE is thrown as shown in the stacktrace.

      Example:
      Mounting:

      mount(new MountedMapper("page/${page}", BlokPage.class));
      

      Request logger:

      09:48:55,246-[ajp-nio-8154-exec-6] INFO  -RequestLogger       -startTime="2017-10-05 07:48:55,093",duration=153,url="https://server/path/page/home?1",event={handler=RenderPageRequestHandler,data={pageId=1,pageParameters={null},renderCount=null}},response={handler=RenderPageRequestHandler,data={pageClass=de.bps.blok.page.simple.ErrorPage,pageId=0,pageParameters={},renderCount=0}},sessionid="A5527CCEAEE7334A805F9EF09D30A7BB",sessionsize=2710,sessioninfo={;page/home?1},sessionstart="2017-10-05 07:48:55,231",requests=2,totaltime=153,activerequests=0,maxmem=2147M,total=1073M,used=198M
      

        Attachments

          Activity

            People

            • Assignee:
              bitstorm Andrea Del Bene
              Reporter:
              laeb Lars Eberle

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment