My env Jetty 8.1
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
//this line prints org.eclipse.jetty.server.Request
System.out.println("class is "+request.getClass().getName());
org.eclipse.jetty.server.Request jettyRequest = (org.eclipse.jetty.server.Request)request;
//request.getServletContext();//this line fails with noSuchMethodError
jettyRequest.getServletContext(); // this line works
...
Can anyone explain this….?
Your webapp isn’t using Servlet API 3.0.
This will fail if you are using Servlet API 2.5 (for example).
Make sure your webapp’s
WEB-INF/web.xmlis set for Servlet API 3.0 and also make sure that any servlet-api jars you might have inWEB-INF/libare removed.