Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3442

StackOverflowError occurred when forwarding request from one controller to other controller using request.getRequestDispatcher(path).forward(request, response)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

      StackOverflowError occurred when forwarding request from one controller to other controller using request.getRequestDispatcher(path).forward(request, response)

      • request and response are injected by CDI. they are proxy class instances.

      @Context
      protected HttpServletRequest request;
      @Context
      protected HttpServletResponse response;

         The request can be forwarded to org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher. But Resteasy can't handle the request and response that are forwarded. Because they are the proxy class instances created by CDI.

       

      Caused by: java.lang.StackOverflowError
          at com.sun.proxy.$Proxy268.setAttribute(Unknown Source)
          at org.apache.catalina.core.ApplicationHttpRequest.setAttribute(ApplicationHttpRequest.java:306)
          at jdk.internal.reflect.GeneratedMethodAccessor183.invoke(Unknown Source)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.base/java.lang.reflect.Method.invoke(Method.java:566)
          at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:146)
          at com.sun.proxy.$Proxy268.setAttribute(Unknown Source)
          at org.apache.catalina.core.ApplicationHttpRequest.setAttribute(ApplicationHttpRequest.java:306)

      org.jboss.resteasy.spi.LoggableFailure: RESTEASY003880: Unable to find contextual data of type: javax.servlet.http.HttpServletRequest
          at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:137)
          at com.sun.proxy.$Proxy268.isAsyncStarted(Unknown Source)
          at javax.servlet.ServletRequestWrapper.isAsyncStarted(ServletRequestWrapper.java:415)
          at org.apache.catalina.core.ApplicationDispatcher.unwrapRequest(ApplicationDispatcher.java:793)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:766)
          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:385)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313)

              rsigal@redhat.com Ronald Sigal
              charlycong@hotmail.com Li Shaojie (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: