views:

321

answers:

1

edit: Retagged as tomcat/jboss, since this could be a question about the Tomcat embedded inside JBoss 6, rather than JBoss itself

I have an extremely simple servlet, which works on Glassfish v3. It uses Servlet 3.0 Asynchronous Processing. Here's a simplified version (which doesn't do much):

@WebServlet(asyncSupported=true)
public class SimpleServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response)
            throws ServletException, IOException {

        final AsyncContext ac = request.startAsync();
        ac.setTimeout(3000);
    }
}

On JBoss 6.0.0 Milestone 2, I get the following Exception:

java.lang.IllegalStateException: The servlet or filters that are being used
          by this request do not support async operation
    at org.apache.catalina.connector.Request.startAsync(Request.java:3096)
    at org.apache.catalina.connector.Request.startAsync(Request.java:3090)
    at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:990)
    at playcomet.SimpleServlet.doGet(SimpleServlet.java:18)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    ...

Do I have to do anything special to enable Asynchronous Processing in JBoss 6? Or do I need an additional deployment descriptor? ...

+1  A: 

If you have web.xml deployed it with.. Just take that out. structure should be

test.war

  • WEB-INF/
  • WEB-INF/classes/*.class

  • WEB-INF/lib/*.jar


Your web.xml is overriding asyncSupported=true annotation and hence the error

Rohit Chourasia
@Rohit: Thanks for digging out my old question and for your answer! I usually can't just remove the web.xml, because I usually need it - so is there a way to achieve `asyncSupported=true` by modifying the web.xml somehow? I can't remember setting it explicitly to `false` in the web.xml. (I don't have my old project setup anymore, but I'm still interested.)
Chris Lercher