Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Getting NullPointerException in ContextHandlerCollection

Hi All,

I am facing a problem in Jetty version 8.1.x.

Using `asyncContext = (AsyncContinuation) baseRequest.startAsync()` to follow the suspend/resume model which jetty provides. When the request is re-dispatched with asyncContext.resume() I get a NullPointerException() in the following code of ContextHandlerCollection.java.

https://github.com/eclipse/jetty.project/blob/jetty-8.1.x/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandlerCollection.java#L190

I see that the asyncContext.getContextHandler() method can return a null and the null check if handled in above code, but still I see a NPE. 

Trace from Arthus

`---ts=2020-06-11 22:52:33;thread_name=qtp877855051-143;id=8f;is_daemon=false;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@18b4aac2
    `---[0.534915ms] org.eclipse.jetty.server.handler.ContextHandlerCollection:handle()
        +---[0.007736ms] org.eclipse.jetty.server.handler.ContextHandlerCollection:getHandlers() #183
        +---[0.006051ms] org.eclipse.jetty.server.Request:getAsyncContinuation() #187
        +---[0.005221ms] org.eclipse.jetty.server.AsyncContinuation:isAsync() #188
        +---[0.263914ms] org.eclipse.jetty.server.AsyncContinuation:getContextHandler() #190 [throws Exception]
        `---[0.0016ms] throw:java.lang.NullPointerException() #905


Could you please let me understand why NPE is thrown here or am I missing something?

Thanks.

Back to the top