导航报错SetDestination() can only be called on an active agent that has been placed on a NavMesh

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_16072507/article/details/53198994
原因:初始化导航组件NavMeshAgent 的时候,agent 离navmesh太远。isOnNavMesh属性为false;
解决办法:
在初始化预制体的时候,传入诞生点位置和旋转信息。
GameObject.Instantiate(m_shooter, m_currBirthPoint.transform.position,m_currBirthPoint.transform.rotation) as GameObject;
而不是直接初始化,后设置诞生点位置。
 GameObject.Instantiate(m_shooter);
shooter.transform.position = m_currBirthPoint.transform.position;

另外:在重新使用SetActive(true);的时候,也要确保agent 离navmesh足够近。
建议在设置SetActive(false);的时候,就不要改变位置信息,以免重新激活时离导航网格太远。
展开阅读全文

【急】 getOutputStream() has already been called for this response

09-26

java.lang.IllegalStateException: getOutputStream() has already been called for this responsern at org.apache.catalina.connector.Response.getWriter(Response.java:611)rn at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)rn at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)rn at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)rn at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:276)rn at java.io.PrintWriter.write(PrintWriter.java:354)rn at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:119)rn at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:326)rn at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:342)rn at com.opensymphony.module.sitemesh.parser.TokenizedHTMLPage.writeBody(TokenizedHTMLPage.java:35)rn at com.opensymphony.module.sitemesh.taglib.decorator.BodyTag.doEndTag(BodyTag.java:26)rn at org.apache.jsp.themes.faces.nh_005fface.decorators.DecoratorMain_jsp._jspx_meth_decorator_005fbody_005f0(DecoratorMain_jsp.java:535)rn at org.apache.jsp.themes.faces.nh_005fface.decorators.DecoratorMain_jsp._jspService(DecoratorMain_jsp.java:315)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)rn at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)rn at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)rn at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)rn at org.apache.jsp.decorators.DecoratorMain_jsp._jspService(DecoratorMain_jsp.java:53)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)rn at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)rn at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)rn at com.opensymphony.module.sitemesh.filter.PageFilter.writeDecorator(PageFilter.java:173)rn at com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:158)rn at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:62)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.smartdot.galaxy.portal.filter.auth.URLProtectionFilter.doFilter(Unknown Source)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.smartdot.galaxy.portal.filter.auth.AuthFilter.doFilter(Unknown Source)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.smartdot.galaxy.portal.filter.ShareLdapConnectionFilter.doFilter(Unknown Source)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.smartdot.util.server.SetCharacterEncodingFilter.doFilter(Unknown Source)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)rn at java.lang.Thread.run(Thread.java:595)rn2011-9-26 18:18:23 org.apache.catalina.core.ApplicationDispatcher invokern严重: Servlet.service() for servlet jsp threw exception 论坛

getOutputStream() has already been called for this response

10-28

在action中执行文件写出,功能是实现文件下载。rn但是response.getOoutputStream()是就出现了以下错误。rnjava.lang.IllegalStateException: getOutputStream() has already been called for this responsernat org.apache.catalina.connector.Response.getWriter(Response.java:604)rn at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)rn at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)rn at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)rn at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)rn at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:178)rn at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)rn at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:77)rn at org.apache.jsp.main_jsp._jspService(main_jsp.java:277)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)rn at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)rn at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)rn at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:156)rn at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)rn at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rnrn在网上看了很多帖,都是在jsp中进行处理的,不是在action中的代码。rn在jsp中很多人都说是用:out.clear(); 和 out = pageContext.pushBody();就不会出现该错误,我没有试,我用的是action。rn所以在这里请教各位大虾,我在action中应该怎么处理啊,帮帮忙啊。 论坛

错误信息:java.lang.IllegalStateException: getOutputStream() has already been called

12-20

java.lang.IllegalStateException: getOutputStream() has already been called for this responsern at org.apache.catalina.connector.Response.getWriter(Response.java:607)rn at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)rn at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)rn at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)rn at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)rn at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:171)rn at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:116)rn at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:76)rn at org.apache.jsp.jspx.temp_jsp._jspService(temp_jsp.java:75)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)rn at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:594)rn at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)rn at org.apache.struts.chain.commands.servlet.PerformForward.handleAsInclude(PerformForward.java:127)rn at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:78)rn at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)rn at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at com.mdao.emap.webapp.filter.WebFilter.doFilter(WebFilter.java:38)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)rn at java.lang.Thread.run(Thread.java:595)rn 论坛

getOutputStream() has already been called for this response 问题

11-25

做一个jsp下载excel的功能,功能描述如下:首先将excel下载到服务器,然后从服务器下载到本地。rn最开始是一个页面,点击下载,用ajax跳转到后台,将文件下载到服务器,然后跳回jsp,执行如下js:rnif(xmlHttpRequest.status==200)//服务器状态码rn var loadDir = "/webrpt/loadFile.jsp?flag=1&dir=BBSJ_DOWNLOAD.zip" ;rn window.location.href (loadDir) ;rnrn此时跳转到下载jsp页面,自动弹出下载窗口,下载jsp loadFile.JSP代码如下:rn[code="java"]rn<%@ page contentType="text/html;charset=GBK" %>rn <%@ page import="java.io.*" %>rn rn rn rn <%rn java.io.BufferedInputStream bis=null;rn java.io.BufferedOutputStream bos=null;rn tryrn String filename=request.getParameter("dir");rn response.reset();rn File fileLoad=new File("D://",request.getParameter("dir"));rn filename=new String(filename.getBytes("iso8859-1"),"gbk");rn response.setContentType("application/x-download");rn response.setHeader("Content-disposition","attachment; filename="+new String(filename.getBytes("gbk"),"iso8859-1"));rn bis=new java.io.BufferedInputStream(new java.io.FileInputStream(fileLoad));rn bos=new java.io.BufferedOutputStream(response.getOutputStream());rn byte[] buff = new byte[2048];rn int bytesRead;rn while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))rn bos.write(buff,0,bytesRead);rn rn bos.flush();rn catch(Exception e)rn e.printStackTrace();rn finallyrn if(bis != null)bis.close();rn if(bos != null)bos.close();rn %>rn rn rn[/code]rn加断点显示,当弹出下载窗口的时候还没报错,再执行之后的outputstream出错,错误信息如下:rn严重: Servlet.service() for servlet debugjsp threw exceptionrnjava.lang.IllegalStateException: getOutputStream() has already been called for this responsern at org.apache.catalina.connector.Response.getWriter(Response.java:596)rn at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:186)rn at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)rn at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)rn at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191)rn at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)rn at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)rn at org.apache.jsp.loadFile_jsp._jspService(org.apache.jsp.loadFile_jsp:84)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)rn at java.lang.Thread.run(Thread.java:595)rnrn整了一天了,一直没有解决。。。。 问答

关于:getOutputStream() has already been called for this response

03-13

最近开发了一个网页,要求从数据库中下载图片!rn程序代码为rn<%byte[] blocco = rsNewsTP.getBytes("ZP");response.setContentType("image/jpeg");ServletOutputStream op = response.getOutputStream();op.write(blocco[0]);%>rn但是运行进提示:rntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjava.lang.IllegalStateException: getOutputStream() has already been called for this responsern org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:599)rn org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:163)rn org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:122)rn org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)rn org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:324)rn org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:335)rn org.apache.jsp.TMPhbt2metzq2_jsp._jspService(TMPhbt2metzq2_jsp.java:388)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.rnrn搞不明白为什么,网络上找过,他们说,<%%>中间不能有空格!但是我己经删除了!!rn还是这样!!!rn 论坛

java.lang.IllegalStateException: getOutputStream() has already been called for

02-13

[code=java]rn09-Feb-2015 10:09:27.784 SEVERE [http-apr-80-exec-18] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet jsp threw exceptionrn java.lang.IllegalStateException: getOutputStream() has already been called for this responsern at org.apache.catalina.connector.Response.getWriter(Response.java:578)rn at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:212)rn at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)rn at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)rn at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)rn at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.getWriter(SaveContextOnUpdateOrErrorResponseWrapper.java:109)rn at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:115)rn at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:108)rn at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:175)rn at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)rn at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)rn at org.apache.jsp.WEB_002dINF.views.fail_jsp._jspService(fail_jsp.java:122)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:431)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)rn at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)rn at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)rn at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:229)rn at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)rn at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)rn at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn[/code]rnrnrnrnrn经过跟踪程序,发现JSP中用这段报的原因 rn<%@ page import="org.apache.commons.codec.binary.Base64"%> rn<%for(int i=0;i rn rnrn<%%> rn中的src="<%=path %>/back/fbsp/viewPic/<%=picPath %>“。这段是输出图片用的,页面上加载10几个图,每个图在200k左右,是在页面没全部加载完时,又刷新页面造成的,不知道如何解决 论坛

没有更多推荐了,返回首页