aspose file tools*
The moose likes Glassfish and the fly likes AyncContext with WebFilter - Glassfish 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Glassfish
Reply locked New topic
Author

AyncContext with WebFilter - Glassfish 4.0

Anirudh Gupta
Ranch Hand

Joined: Dec 08, 2010
Posts: 48

Hi,

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.

Logs
Glassfish4.0

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 [/0.0.0.0:7,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(Request.java:4259)
at org.apache.catalina.connector.Request.startAsync(Request.java:4236)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1044)
at come.lets.learn.async.AsyncDemoServlet.doPost(AsyncDemoServlet.java:52)
at come.lets.learn.async.AsyncDemoServlet.doGet(AsyncDemoServlet.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)


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(ServletRequestImpl.java:1829)
at weblogic.servlet.internal.ServletRequestImpl.startAsync(ServletRequestImpl.java:1816)
at come.lets.learn.async.AsyncDemoServlet.doPost(AsyncDemoServlet.java:52)
at come.lets.learn.async.AsyncDemoServlet.doGet(AsyncDemoServlet.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
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 127.0.0.1:1,433 during the configured idle timeout of 5 seconds.>




The Servlet -


The Runnable -



The Filters -
Filter 1


Filter 2 -


The Listener

Thanks.


Regards,
Anirudh
Anirudh Gupta
Ranch Hand

Joined: Dec 08, 2010
Posts: 48

Hi All,

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

Thanks nonetheless.

Regards,
Anirudh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AyncContext with WebFilter - Glassfish 4.0