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

o.a.w.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl throws NPE when posting EventBus inside Atmosphere request

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 6.9.1, 6.10.0
    • 6.13.0
    • wicket, wicket-atmosphere
    • None
    • happens on wicket 6.9.1 and 6.10.1 using wicket-atmosphere 0.11, atmosphere-runtime 1.0.13
      (not yet tested with wicket-atmosphere 0.13)
      Tomcat 7.0

    Description

      Sometimes happens when during an Wicket-Atmosphere request, i.e. inside an Atmosphere's @Subscribe handler, we post an object to Wicket-Atmosphere's EventBus.

      In all cases where it happens, it happens when EventBus.post called from a non-Wicket thread.

      08:17:46.460 | ERROR | oryBean_Worker-9 | c.g.c.e.E.default                | .google.common.eventbus.EventBus  316 | Could not dispatch event: Job DEFAULT.loadToArchive execution complete at  08:17:46 07/22/2013 and reports: exitCode=COMPLETED;exitDescription=Loaded 1 CSVs to Archive as archived/2013-07-22T08:17:46.098-04:00.csv, 1 point times made stale: [2013-07-22T12:15:00.000Z] to handler [wrapper public void org.soluvas.web.site.AtmosphereApplication.bridgeToAtmosphere(java.lang.Object)]
      java.lang.reflect.InvocationTargetException: null
              at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source) ~[na:na]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_15]
              at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_15]
              at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-14.0.1.jar:na]
              at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) ~[guava-14.0.1.jar:na]
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) [guava-14.0.1.jar:na]
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) [guava-14.0.1.jar:na]
              at com.google.common.eventbus.EventBus.post(EventBus.java:267) [guava-14.0.1.jar:na]
              at com.quikdo.freq.job.EventBusJobListener.jobWasExecuted(EventBusJobListener.java:54) [EventBusJobListener.class:na]
              at org.quartz.core.QuartzScheduler.notifyJobListenersWasExecuted(QuartzScheduler.java:2020) [quartz-2.2.0.jar:na]
              at org.quartz.core.JobRunShell.notifyJobListenersComplete(JobRunShell.java:355) [quartz-2.2.0.jar:na]
              at org.quartz.core.JobRunShell.run(JobRunShell.java:229) [quartz-2.2.0.jar:na]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560) [quartz-2.2.0.jar:na]
      Caused by: java.lang.NullPointerException: null
              at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:194) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:113) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:83) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:448) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:337) ~[wicket-atmosphere-0.11.jar:0.11]
              at org.apache.wicket.atmosphere.EventBus.postToSingleResource(EventBus.java:317) ~[wicket-atmosphere-0.11.jar:0.11]
              at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:292) ~[wicket-atmosphere-0.11.jar:0.11]
              at org.soluvas.web.site.AtmosphereApplication.bridgeToAtmosphere(AtmosphereApplication.java:53) ~[org.soluvas.web.site-2.1.0-SNAPSHOT.jar:na]
              ... 13 common frames omitted
      08:17:46.465 | ERROR | ryBean_Worker-10 | c.g.c.e.E.default                | .google.common.eventbus.EventBus  316 | Could not dispatch event: Job DEFAULT.locationVisitorAggregator fired (by trigger DEFAULT.MT_3jn71esi0mkgo) at:  08:17:46 07/22/2013 to handler [wrapper public void org.soluvas.web.site.AtmosphereApplication.bridgeToAtmosphere(java.lang.Object)]
      java.lang.reflect.InvocationTargetException: null
              at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source) ~[na:na]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_15]
              at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_15]
              at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-14.0.1.jar:na]
              at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) ~[guava-14.0.1.jar:na]
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) [guava-14.0.1.jar:na]
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) [guava-14.0.1.jar:na]
              at com.google.common.eventbus.EventBus.post(EventBus.java:267) [guava-14.0.1.jar:na]
              at com.quikdo.freq.job.EventBusJobListener.jobToBeExecuted(EventBusJobListener.java:37) [EventBusJobListener.class:na]
              at org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzScheduler.java:1980) [quartz-2.2.0.jar:na]
              at org.quartz.core.JobRunShell.notifyListenersBeginning(JobRunShell.java:339) [quartz-2.2.0.jar:na]
              at org.quartz.core.JobRunShell.run(JobRunShell.java:174) [quartz-2.2.0.jar:na]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560) [quartz-2.2.0.jar:na]
      Caused by: java.lang.NullPointerException: null
              at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:194) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:113) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:83) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:448) ~[wicket-core-6.9.1.jar:6.9.1]
              at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:337) ~[wicket-atmosphere-0.11.jar:0.11]
              at org.apache.wicket.atmosphere.EventBus.postToSingleResource(EventBus.java:317) ~[wicket-atmosphere-0.11.jar:0.11]
              at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:292) ~[wicket-atmosphere-0.11.jar:0.11]
              at org.soluvas.web.site.AtmosphereApplication.bridgeToAtmosphere(AtmosphereApplication.java:53) ~[org.soluvas.web.site-2.1.0-SNAPSHOT.jar:na]
              ... 13 common frames omitted
      

      The NPE happens inside wicket-core, so hopefully wicket-core can give more detailed exception why it's doing so.

      And org.apache.wicket.atmosphere.EventBus.post should probably check its arguments that may cause NPE on wicket-core's part.

      Attachments

        Issue Links

          Activity

            People

              papegaaij Emond Papegaaij
              ceefour Hendy Irawan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: