users@grizzly.java.net

NPE when calling AsyncContext#complete

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 13 Jan 2009 18:07:33 -0800

[Reposting to correct list]

I think I have run into a regression when trying Servlet 3.0 async
support on top
of Grizzly.

Following is a very simple servlet:

  @WebServlet(urlPatterns = {"/test"}, asyncSupported = true)
  public class TestServlet extends HttpServlet {

      public void doGet(HttpServletRequest req, HttpServletResponse res)
              throws IOException, ServletException {

          if (!req.isAsyncSupported()) {
              throw new ServletException("Async not supported when it
should");
          }

          req.startAsync().complete();
      }
  }


When I access it, I get the attached stack trace.

To reproduce, deploy the attached WAR and access /async/test

Any help/hints appreciated.

Thanks!


Jan





[#|2009-01-14T07:16:05.279+0800|SEVERE|glassfish|javax.enterprise.system.container.web|_ThreadID=19;_ThreadName=Thread-3;|StandardWrapperValve[TestServlet]: PWC1406: Servlet.service() for servlet TestServlet threw exception
java.lang.NullPointerException
        at com.sun.grizzly.tcp.Response$ResponseAttachment.resume(Response.java:930)
        at com.sun.grizzly.tcp.Response.resume(Response.java:737)
        at org.apache.catalina.connector.Request.asyncComplete(Request.java:3993)
        at org.apache.catalina.connector.AsyncContextImpl.complete(AsyncContextImpl.java:165)
        at test.TestServlet.doGet(TestServlet.java:27)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:465)
        at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:460)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:720)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:658)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:183)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:720)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:658)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:652)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1031)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:720)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:658)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:652)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1031)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
        at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:646)
        at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:821)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:153)
        at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
|#]