这个问题如何解决?Cannot forward after response has been committed

05-07-22 rabbitbug
这个问题如何解决?Cannot forward after response has been committed

做了一个应用

是在JBoss-3.2.7上的

用户自己去登陆时

一点也没问题

现在用LoadRunner去进行注册时

用了一二个用户做并发测试都会抛出异常

是在执行下面语句时出错的

this.getServletContext().getRequestDispatcher("/main.jsp").forward(req, res);

我在此语句之前已经去掉了写到后台语句

System.out.println(""); //这样的语句全注释掉了

我在server.xml里也改过最大线程数为200

如下

<Connector port="8088" address="${jboss.bind.address}"

maxThreads="200" minSpareThreads="25" maxSpareThreads="75"

enableLookups="false" redirectPort="8443" acceptCount="10" debug="0"

connectionTimeout="20000" disableUploadTimeout="true"/>

为什么还会出这样的错呢?

才一二个用户啊都出错

想想也不太可能啊

出错信息是:

2005-07-22 15:00:27,656 ERROR [org.jboss.web.localhost.Engine] StandardWrapperValve[loginservlet]: Servlet.service() for servlet loginservlet threw exception

java.lang.IllegalStateException: Cannot forward after response has been committed

at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:324)

at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)

at com.saintbo.servlet.sys.LoginServlet.handle(LoginServlet.java:82)

at com.saintbo.servlet.MyExtendedServlet.service(MyExtendedServlet.java:75)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:162)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:536)

aill
2005-07-24 10:06
估计你的response在forward()执行前已经返回

猜你喜欢