You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Roszko <an...@cuberoute.com> on 2004/06/08 18:13:44 UTC

Servlet Exception of forward method

Hey there,

We're running Tomcat 5.0.19 and it's been working really well to date.  We
did, however, run into an issue last Friday and were hoping to get some more
information.  Our logs indicate that everything was running smoothly until a
ServletException (stack trace below) was thrown when our controller servlet
was attempting to forward to a JSP page.

e.g. 	getRequestDispatcher(request, url).forward(request, response);

The server seemed to enter some sort of "uncertain" state - it could process
certain requests and not others (in no real deterministic fashion).  It
seemed to degrade over the course of about ten minutes with more and more
requests producing Exceptions until we finally restarted.  We haven't had a
problem since.

javax.servlet.ServletException
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:256)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:284)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:204)org.apache.catalina.core.ApplicationDispatcher.invoke(Applicati
onDispatcher.java:750)
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDis
patcher.java:510)org.apache.catalina.core.ApplicationDispatcher.doForward(Ap
plicationDispatcher.java:445)org.apache.catalina.core.ApplicationDispatcher.
forward(ApplicationDispatcher.java:359)com.cuberoute.controller.AbstractCont
roller.forward(AbstractController.java:96)com.cuberoute.controller.Protected
HTMLController.forwardWithMap(ProtectedHTMLController.java:51)com.cuberoute.
controller.ProtectedHTMLController.handleAction_customer_query(ProtectedHTML
Controller.java:1832)sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)


The doGet method of our servlet catches any exceptions that may be thrown
over the course of a request being processed.  In the forementioned case,
the ServletException was caught, stored in the session and a
"redirectToError" method is called, which simply redirects the user to a
generic error page.  This scenario repeated itself several times - with
several ServletExceptions being thrown for a number of different users on
the system.

Once ServletExceptions had already been thrown, there was also a scenario
where the redirection to the error page would fail - an
IllegalStateException was thrown with the following stack trace (formatted
by our logger).  I'm not 100% why this redirection would fail in this case
and not in the cases above where we could get to the error page to see the
ServletException.  Perhaps the forward method succeeded in this case to the
point that the response was deemed to be committed - hence the
IllegalStateException.

  <exception>
    <message><null/></message>
    <trace>
      <frame>
        <class>org.apache.coyote.tomcat5.CoyoteResponseFacade</class>
        <method>sendRedirect</method>
        <line>399</line>
      </frame>
      <frame>
        <class>com.cuberoute.controller.AbstractController</class>
        <method>redirect</method>
        <line>103</line>
      </frame>
      <frame>
        <class>com.cuberoute.controller.ProtectedHTMLController</class>
        <method>redirectToError</method>
        <line>43</line>
      </frame>
      <frame>
        <class>com.cuberoute.controller.AbstractController</class>
        <method>doGet</method>
        <line>246</line>
      </frame>
      <frame>
        <class>javax.servlet.http.HttpServlet</class>
        <method>service</method>
        <line>743</line>
      </frame>
      <frame>
        <class>javax.servlet.http.HttpServlet</class>
        <method>service</method>
        <line>856</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.ApplicationFilterChain</class>
        <method>internalDoFilter</method>
        <line>284</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.ApplicationFilterChain</class>
        <method>doFilter</method>
        <line>204</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardWrapperValve</class>
        <method>invoke</method>
        <line>257</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardValveContext</class>
        <method>invokeNext</method>
        <line>151</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardPipeline</class>
        <method>invoke</method>
        <line>567</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardContextValve</class>
        <method>invokeInternal</method>
        <line>245</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardContextValve</class>
        <method>invoke</method>
        <line>199</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardValveContext</class>
        <method>invokeNext</method>
        <line>151</line>
      </frame>
      <frame>
        <class>org.apache.catalina.authenticator.AuthenticatorBase</class>
        <method>invoke</method>
        <line>587</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardValveContext</class>
        <method>invokeNext</method>
        <line>149</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardPipeline</class>
        <method>invoke</method>
        <line>567</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardHostValve</class>
        <method>invoke</method>
        <line>184</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardValveContext</class>
        <method>invokeNext</method>
        <line>151</line>
      </frame>
      <frame>
        <class>org.apache.catalina.valves.ErrorReportValve</class>
        <method>invoke</method>
        <line>164</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardValveContext</class>
        <method>invokeNext</method>
        <line>149</line>
      </frame>
      <frame>
        <class>org.apache.catalina.valves.AccessLogValve</class>
        <method>invoke</method>
        <line>578</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardValveContext</class>
        <method>invokeNext</method>
        <line>149</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardPipeline</class>
        <method>invoke</method>
        <line>567</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardEngineValve</class>
        <method>invoke</method>
        <line>156</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardValveContext</class>
        <method>invokeNext</method>
        <line>151</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.StandardPipeline</class>
        <method>invoke</method>
        <line>567</line>
      </frame>
      <frame>
        <class>org.apache.catalina.core.ContainerBase</class>
        <method>invoke</method>
        <line>972</line>
      </frame>
      <frame>
        <class>org.apache.coyote.tomcat5.CoyoteAdapter</class>
        <method>service</method>
        <line>206</line>
      </frame>
      <frame>
        <class>org.apache.coyote.http11.Http11Processor</class>
        <method>process</method>
        <line>833</line>
      </frame>
      <frame>

<class>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler</clas
s>
        <method>processConnection</method>
        <line>732</line>
      </frame>
      <frame>
        <class>org.apache.tomcat.util.net.TcpWorkerThread</class>
        <method>runIt</method>
        <line>619</line>
      </frame>
      <frame>

<class>org.apache.tomcat.util.threads.ThreadPool$ControlRunnable</class>
        <method>run</method>
        <line>688</line>
      </frame>
      <frame>
        <class>java.lang.Thread</class>
        <method>run</method>
        <line>534</line>
      </frame>
    </trace>
  </exception>


Has anyone ever seen this sort of thing before?

Thanks a million!!

Andrew

Andrew Roszko
Software Developer
CubeRoute Inc.
Toronto, Ontario


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org