You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mete BALCI <me...@gmail.com> on 2011/10/14 12:05:40 UTC

async per servlet 3.0

Hello,

I am trying to use Servlet 3 async support in Tomcat 7.0.21. I tried setting
annotation asyncSupported=true and writing this to web.xml, tried using apr
and nio, still getting false from isAsyncSupported, what am I missing ?

Mete

PS: There is no filter, just a single servlet overriding doPost, marked
with @WebServlet(asyncSupported = true, urlPatterns = {"/2/*"})

Re: async per servlet 3.0

Posted by Mete BALCI <me...@gmail.com>.
I want to clarify the situation with a simpler example.

I have created a war with 2 servlets, without a web.xml. So war contains
only 2 classes (for each servlet).

One servlet is annotated as:
@WebServlet(value = "/async", asyncSupported = true)

Other is annotated as:
@WebServlet(value = "/sync")

Both overrides the service method with this code:
resp.getWriter().print("async=" + req.isAsyncSupported());

I am deploying this to Tomcat 7.0.21 running on JDK 1.6.0_27 on Linux
(ubuntu 10.04 x32) with APR connector.

When I call /sync and /async, both of them displays async=false

Mete

On Fri, Oct 14, 2011 at 1:43 PM, Mete BALCI <me...@gmail.com> wrote:

> web.xml root is:
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>       version="3.0">
>
> I tried mapping both with annotation and web.xml. Annotation itself works,
> I can use it without async, but isAsyncSupported returns false (both with
> annotation and web.xml mapping) so I cannot startAsync (raises IllegalState)
>
> Mete
>
> On Fri, Oct 14, 2011 at 1:38 PM, Konstantin Kolinko <
> knst.kolinko@gmail.com> wrote:
>
>> 2011/10/14 Mete BALCI <me...@gmail.com>:
>> > Hello,
>> >
>> > I am trying to use Servlet 3 async support in Tomcat 7.0.21. I tried
>> setting
>> > annotation asyncSupported=true and writing this to web.xml, tried using
>> apr
>> > and nio, still getting false from isAsyncSupported, what am I missing ?
>> >
>> > Mete
>> >
>> > PS: There is no filter, just a single servlet overriding doPost, marked
>> > with @WebServlet(asyncSupported = true, urlPatterns = {"/2/*"})
>>
>> What is at the top of your web.xml? Is it using 3.0 version of schema?
>> Compare it with the examples webapp.
>>
>> If the servlet mapped using the annotation, or it is explicitly mapped
>> in web.xml?
>>
>> Best regards,
>> Konstantin Kolinko
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: async per servlet 3.0

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/14 Mete BALCI <me...@gmail.com>:
> I found the problem using new Exception().printStackTrace()
>
> The problem was PsiProbe application that I am using to monitor Tomcat. The
> valve it is using to instrument tomcat is probably not async aware. After
> undeploying it, async support works as expected. I will notify PsiProbe team
> about the issue.

OK. A fix might look like
http://svn.apache.org/viewvc?view=revision&revision=823713

>>
>> 2. Try (new Exception().printStackTrace()) in your servlet, so that it
>> prints stacktrace with all Filters and Valves that are in the chain
>> that serves your request.
>>

Best regards,
Konstantin Kolinko

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


Re: async per servlet 3.0

Posted by Mete BALCI <me...@gmail.com>.
I found the problem using new Exception().printStackTrace()

The problem was PsiProbe application that I am using to monitor Tomcat. The
valve it is using to instrument tomcat is probably not async aware. After
undeploying it, async support works as expected. I will notify PsiProbe team
about the issue.

Thanks Konstantin.

Mete

On Fri, Oct 14, 2011 at 2:50 PM, Konstantin Kolinko
<kn...@gmail.com>wrote:

> 2011/10/14 Mete BALCI <me...@gmail.com>:
> > web.xml root is:
> > <web-app xmlns="http://java.sun.com/xml/ns/javaee"
> >      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> > http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
> >      version="3.0">
> >
> > I tried mapping both with annotation and web.xml. Annotation itself
> works, I
> > can use it without async, but isAsyncSupported returns false (both with
> > annotation and web.xml mapping) so I cannot startAsync (raises
> IllegalState)
>
> 1. If you were mapping it explicitly, were you using the following for
> the servlet as the examples webapp does?
>
>      <async-supported>true</async-supported>
>
> 2. Try (new Exception().printStackTrace()) in your servlet, so that it
> prints stacktrace with all Filters and Valves that are in the chain
> that serves your request.
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: async per servlet 3.0

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/14 Mete BALCI <me...@gmail.com>:
> web.xml root is:
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>      version="3.0">
>
> I tried mapping both with annotation and web.xml. Annotation itself works, I
> can use it without async, but isAsyncSupported returns false (both with
> annotation and web.xml mapping) so I cannot startAsync (raises IllegalState)

1. If you were mapping it explicitly, were you using the following for
the servlet as the examples webapp does?

      <async-supported>true</async-supported>

2. Try (new Exception().printStackTrace()) in your servlet, so that it
prints stacktrace with all Filters and Valves that are in the chain
that serves your request.

Best regards,
Konstantin Kolinko

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


Re: async per servlet 3.0

Posted by Mete BALCI <me...@gmail.com>.
web.xml root is:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0">

I tried mapping both with annotation and web.xml. Annotation itself works, I
can use it without async, but isAsyncSupported returns false (both with
annotation and web.xml mapping) so I cannot startAsync (raises IllegalState)

Mete

On Fri, Oct 14, 2011 at 1:38 PM, Konstantin Kolinko
<kn...@gmail.com>wrote:

> 2011/10/14 Mete BALCI <me...@gmail.com>:
> > Hello,
> >
> > I am trying to use Servlet 3 async support in Tomcat 7.0.21. I tried
> setting
> > annotation asyncSupported=true and writing this to web.xml, tried using
> apr
> > and nio, still getting false from isAsyncSupported, what am I missing ?
> >
> > Mete
> >
> > PS: There is no filter, just a single servlet overriding doPost, marked
> > with @WebServlet(asyncSupported = true, urlPatterns = {"/2/*"})
>
> What is at the top of your web.xml? Is it using 3.0 version of schema?
> Compare it with the examples webapp.
>
> If the servlet mapped using the annotation, or it is explicitly mapped
> in web.xml?
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: async per servlet 3.0

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/14 Mete BALCI <me...@gmail.com>:
> Hello,
>
> I am trying to use Servlet 3 async support in Tomcat 7.0.21. I tried setting
> annotation asyncSupported=true and writing this to web.xml, tried using apr
> and nio, still getting false from isAsyncSupported, what am I missing ?
>
> Mete
>
> PS: There is no filter, just a single servlet overriding doPost, marked
> with @WebServlet(asyncSupported = true, urlPatterns = {"/2/*"})

What is at the top of your web.xml? Is it using 3.0 version of schema?
Compare it with the examples webapp.

If the servlet mapped using the annotation, or it is explicitly mapped
in web.xml?

Best regards,
Konstantin Kolinko

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