Getting org.jboss.resteasy.spi.UnhandledException or java.lang.ClassCastException when forwarding REST request
Issue
When forwarding a RESTEASY request , for example :
@Path("/")
public class MockResource {
private ServletContext ctx;
@GET
@Path("/create")
@Produces(MediaType.TEXT_HTML)
public void createMock(@Context HttpServletRequest req, @Context HttpServletResponse res) throws IOException, ServletException {
ctx.getRequestDispatcher(getPath("create")).forward(req, res);
}
…
}
The following exceptions are thrown:
- org.jboss.resteasy.spi.UnhandledException: javax.servlet.ServletException: Original SevletRequest or wrapped original ServletRequest not passed to RequestDispatcher in violation of SRV.8.2 and SRV.14.2.5.1
Or
- java.lang.ClassCastException: $Proxy280 cannot be cast to javax.servlet.ServletRequestWrapper at org.apache.catalina.core.ApplicationFilterFactory.createFilterChain(ApplicationFilterFactory
Environment
- JBoss Enterprise Application Platform (EAP) 6
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.