Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
    Bookmark Topic Watch Topic
  • New Topic

AyncContext with WebFilter - Glassfish 4.0  RSS feed

Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Report post to moderator

I started exploring AyncContext and got down to sort of a demo. I used Servlet 3.0 on Glassfish 4.0, Eclipse Kepler.
Every time I deployed my app I received IllegalStateException since the WebFilter configured did not support AsyncContext.

After the first time, I cleaned and redeployed the app, but the problem persisted. The WebServlet And WebFilter annotations
had BOTH been provided the attribute asyncSupported=true.

Is this a bug with the Glassfish 4.0 AyncContext implementation or is it just me....?

I have appended ALL my code now. Even more infuriating is that in Weblogic 12.1.1 the servlet(without any filter)
doesn't work at all.


INFO: Loading application [AsyncDemo] at [/AsyncDemo]
INFO: AsyncDemo was successfully deployed in 5,938 milliseconds.
INFO: Grizzly Framework 2.3.1 started in: 15ms - bound to [/,676]
INFO: Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@5d5250 as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@1d1d4e6.
WARNING: StandardWrapperValve[come.lets.learn.async.AsyncDemoServlet]: Servlet.service() for servlet come.lets.learn.async.AsyncDemoServlet threw exception
java.lang.IllegalStateException: Request is within the scope of a filter or servlet that does not support asynchronous operations
at org.apache.catalina.connector.Request.startAsync(
at org.apache.catalina.connector.Request.startAsync(
at org.apache.catalina.connector.RequestFacade.startAsync(
at come.lets.learn.async.AsyncDemoServlet.doPost(
at come.lets.learn.async.AsyncDemoServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.StandardWrapper.service(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardPipeline.doInvoke(
at org.apache.catalina.core.StandardPipeline.invoke(
at com.sun.enterprise.web.WebPipeline.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.doService(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.glassfish.grizzly.http.server.HttpHandler.runService(
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(
at org.glassfish.grizzly.ProcessorExecutor.execute(
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(
at org.glassfish.grizzly.threadpool.AbstractThreadPool$

Weblogic 12.1.1

<Aug 24, 2013 7:42:15 AM IST> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "AdminServer" for domain "MY_DOMAIN" running in development mode.>
<Aug 24, 2013 7:42:15 AM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
<Aug 24, 2013 7:42:15 AM IST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>
<Aug 24, 2013 7:46:17 AM IST> <Error> <HTTP> <BEA-101020> <[ServletContext@13887382[app:_auto_generated_ear_ module:AsyncDemoWLS path:null spec-version:3.0]] Servlet failed with an Exception
java.lang.IllegalStateException: The async-support is disabled on this request: weblogic.servlet.internal.ServletRequestImpl@1420a24[
GET /AsyncDemoWLS/AsyncDemoServlet HTTP/1.1
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

at weblogic.servlet.internal.ServletRequestImpl.startAsync(
at weblogic.servlet.internal.ServletRequestImpl.startAsync(
at come.lets.learn.async.AsyncDemoServlet.doPost(
at come.lets.learn.async.AsyncDemoServlet.doGet(
at javax.servlet.http.HttpServlet.service(
Truncated. see log file for complete stacktrace
<Aug 24, 2013 7:46:21 AM IST> <Warning> <Socket> <BEA-000449> <Closing the socket, as no data read from it on,433 during the configured idle timeout of 5 seconds.>

The Servlet -

The Runnable -

The Filters -
Filter 1

Filter 2 -

The Listener

Anirudh Gupta
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,

There was a oversight on my side, I've figured it out since.

Thanks nonetheless.

    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!