2012/5/14 rohit patil <sparkb...@gmail.com>:
> Hi All,
> I have written the below piece of code (NewServlet.java) to try the Servlet
> 3.0 async feature.
> But it is failing by throwing up the below mentioned error.
>
> Tomcat Version: 7.0.27 (32 bit)
> OS: Windows 7
>
> java.lang.IllegalStateException: Not supported.
>    at org.apache.catalina.connector.Request.startAsync(Request.java:1664)
>    at
> org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1030)
>    at
> javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
>
> code snippet:
>   try{
>            boolean asynSupported = request.isAsyncSupported();
>            System.out.println("asynSupported: "+asynSupported);
>            AsyncContext async = request.startAsync(request,
> response);   *//exception
> is thrown at this point
> *            messageSender.addConnection(async);
>            AlertListener alertListener = new AlertListener(messageSender);
>            async.start(alertListener);
>
>        } catch (Throwable thr){
>            thr.printStackTrace();
>        }
>
> web.xml snippet:
>
>    <servlet>
>        <servlet-name>NewServlet</servlet-name>
>
> <servlet-class>sample.comet.NewServlet</servlet-class>
>        <async-supported>true</async-supported>
>    </servlet>


1. You must have the same setting for all all filters in your request
processing chain.

Your stacktrace from IllegalStateException should have mentioned them.

All the valves in the chain should also support async processing (that
is declared programmatically, via Valve.isAsyncSupported() ).

2. Your web.xml (and conf/web.xml) should mark themselves as adhering
to the Sevlet 3.0 specification (with version and probably with
xsi:schemaLocation attributes on the root element).

> server.xml snippet :
>
> <Connector connectionTimeout="20000" port="8084"
> protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
>
> Even the sample program "AsyncRequest" that comes with tomcat does not
> work. :-(   it also throws the same exception.

You mean those listed at the bottom of the following page:
http://localhost:8080/examples/jsp/

I've just tested and those examples work with Nio connector in 7.0.27.
I am on WinXP.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to