Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Cannot Reproduce
-
6.10.0
-
None
-
None
-
wicket-atmosphere 0.11, WebSockets protocol
Description
When AtmosphereEventBus.post() is called from a non-Wicket thread (and no web request), it fails with the following, due to NullPointerException: null at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl()
2013-08-22 08:48:30.656 04:49:23.551 | ERROR | oryBean_Worker-7 | o.a.w.DefaultExceptionMapper | he.wicket.DefaultExceptionMapper 123 | Unexpected error occurred org.apache.wicket.WicketRuntimeException: An error occurred while generating an Url for handler 'org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler@6f93daec' at org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:535) [wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.Component.urlFor(Component.java:3347) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractAjaxBehavior.java:88) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.renderAjaxAttributes(AbstractDefaultAjaxBehavior.java:223) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.renderAjaxAttributes(AbstractDefaultAjaxBehavior.java:207) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript(AbstractDefaultAjaxBehavior.java:457) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AjaxEventBehavior.renderHead(AjaxEventBehavior.java:83) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.Component.renderHead(Component.java:2714) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy$1.component(ChildFirstHeaderRenderStrategy.java:85) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:96) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:51) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderChildHeaders(ChildFirstHeaderRenderStrategy.java:78) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:57) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AbstractAjaxResponse.writeHeaderContribution(AbstractAjaxResponse.java:464) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.XmlAjaxResponse.writeComponent(XmlAjaxResponse.java:110) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AbstractAjaxResponse.writeComponents(AbstractAjaxResponse.java:213) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AbstractAjaxResponse.writeTo(AbstractAjaxResponse.java:145) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.ajax.AjaxRequestHandler.respond(AjaxRequestHandler.java:359) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:861) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) ~[wicket-request-6.10.0.jar:6.10.0] at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:97) ~[wicket-request-6.10.0.jar:6.10.0] at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261) [wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218) [wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) [wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:341) ~[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] at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25] 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.10.0.jar:6.10.0] at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getClientUrl(ServletWebRequest.java:148) ~[wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.atmosphere.AtmosphereWebRequest.getClientUrl(AtmosphereWebRequest.java:112) ~[wicket-atmosphere-0.11.jar:0.11] at org.apache.wicket.request.UrlRenderer.shouldRenderAsFull(UrlRenderer.java:354) ~[wicket-request-6.10.0.jar:6.10.0] at org.apache.wicket.request.UrlRenderer.renderUrl(UrlRenderer.java:100) ~[wicket-request-6.10.0.jar:6.10.0] at org.apache.wicket.request.cycle.RequestCycle.renderUrl(RequestCycle.java:548) [wicket-core-6.10.0.jar:6.10.0] at org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:530) [wicket-core-6.10.0.jar:6.10.0] ... 49 common frames omitted at org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:123) at org.apache.wicket.DefaultExceptionMapper.map(DefaultExceptionMapper.java:62) at org.apache.wicket.request.cycle.RequestCycle.handleException(RequestCycle.java:352) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:229) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:341) at org.apache.wicket.atmosphere.EventBus.postToSingleResource(EventBus.java:317) at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:292)
Note that although there is no web request, the Atmosphere EventBus.post() should still work.
Also FYI, not sure if this helps, a WebSocket request scheme is "WebSocket", not "http" nor "http".
Related to WICKET-5134, WICKET-5084, WICKET-5280.
Attachments
Issue Links
- duplicates
-
WICKET-5282 o.a.w.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl throws NPE when posting EventBus inside Atmosphere request
- Closed