I'm getting the following exception while calling a servlet:
com.ibm.ws.webcontainer.async.AsyncIllegalStateException: SRVE8010E: The current request does not support asynchronous servlet processing.
The servlet looks like this:
public class AsyncServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
AsyncContext async = req.startAsync();
async.start(new Runnable(){
@Override
public void run() {
System.out.println("Bazinga");
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
I've tried to set it as asynchronous using annotations:
@WebServlet(urlPatterns = "/asyncServlet", asyncSupported = true)
And also in web.xml after reading a post in a forum:
<servlet>
<display-name>AsyncServlet</display-name>
<servlet-name>AsyncServlet</servlet-name>
<servlet-class>com.lala.lala.AsyncServlet</servlet-class>
<init-param>
<param-name>com.ibm.ws.webcontainer.async-supported</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>AsyncServlet</servlet-name>
<url-pattern>/asyncServlet</url-pattern>
</servlet-mapping>
Still getting the AsyncIllegalStateException. How did you get async servlets run on WAS8?