论坛首页 Java企业应用论坛

用Spring MVC不在TOMCAT8里配置域名时不报错,配完点两下就报如下错误,求解

浏览 4342 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2015-02-06  
这是在tomcat8里配置的域名

<Host name="www.xxx.com" debug="0" appBase="D:\\Program Files\\apache-tomcat-8.0.17\\webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
       <Alias>www.xxx.cn</Alias>
       <Alias>www.xxx.net</Alias>
       <Alias>www.xxx.com.cn</Alias>
       <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
            timestamp="true"/>
       <Context path="" docBase="D:\\Program Files\\apache-tomcat-8.0.17\\webapps\\sp"  reloadable="true" caseSensitive="false" debug="0"></Context>
</Host>




点击下报的错误信息如下:

06-Feb-2015 10:41:34.781 SEVERE [http-apr-80-exec-3] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet jsp threw exception
 java.lang.IllegalStateException: getOutputStream() has already been called for this response
	at org.apache.catalina.connector.Response.getWriter(Response.java:578)
	at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:212)
	at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)
	at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)
	at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)
	at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.getWriter(SaveContextOnUpdateOrErrorResponseWrapper.java:109)
	at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:115)
	at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:108)
	at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:175)
	at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)
	at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
	at org.apache.jsp.WEB_002dINF.views.fail_jsp._jspService(fail_jsp.java:122)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:431)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:229)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at com.aokunsang.security.MyFilterSecurityInterceptor.doFilter(MyFilterSecurityInterceptor.java:66)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:285)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2431)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2420)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

   发表时间:2015-02-06  
你的代码当中有未关闭的请求
0 请登录后投票
   发表时间:2015-02-06  
spring mvc有啥请求需要关???没太明白
0 请登录后投票
   发表时间:2015-02-06  
@RequestMapping(value = "/homeTabPage")
public String  homePage(PageHomeParam pageParam,Fbsp queryParam,HttpServletRequest request,ModelMap map){
        String spmc = "";//PageHomeParam
        String spflid = request.getParameter("spflid");
try {
if(StringUtils.isNotEmpty(request.getParameter("spmc")) ) {
spmc = new String(request.getParameter("spmc").getBytes("ISO-8859-1"),"UTF-8");
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
queryParam.setFbspId(spflid);
queryParam.setFbspCpmc(spmc);
PageData<Fbsp> data=this.fbspService.findHomePageData(pageParam, queryParam);
request.setAttribute("Fbsp", queryParam);
request.setAttribute("data", data);

String queryHTML=BeanUtils.getNotEpmtyValueList(queryParam);
queryHTML+=BeanUtils.getNotEpmtyValueList(pageParam);
request.setAttribute("queryCondHTML", queryHTML);
String retStr="adminTab";

return retStr;
}

这个方有啥不对的??
0 请登录后投票
   发表时间:2015-02-06  
我是第一个页没全部运行完,然后就点第二个面,反复点就出这个错误
0 请登录后投票
   发表时间:2015-02-08  
那位知道,指点一下,谢谢
0 请登录后投票
   发表时间:2015-02-11  
页面当中的response当中应该清空,所以说有未关闭的请求
0 请登录后投票
   发表时间:2015-02-12  
你说的是jsp页中的吗,JSP里我也没有用到过response呀
0 请登录后投票
   发表时间:2015-02-13  
经过跟踪程序,发现JSP中用这段报的原因
<%@ page import="org.apache.commons.codec.binary.Base64"%>
<%for(int i=0;i<pageData.getRows().size();i++){
  Fbsp u=pageData.getRows().get(i);
  String picPath=new String( Base64.encodeBase64(u.getFbspYh().getBytes("utf-8")));
%>
<a href="<%=path %>/dd/commodity/detailPage/<%=u.getFbspId() %>" target="_parent"><img class="pic" alt="全年最低价!" src="<%=path %>/back/fbsp/viewPic/<%=picPath %>"></a>

<%}%>
中的src="<%=path %>/back/fbsp/viewPic/<%=picPath %>“。这段是输出图片用的,页面上加载10几个图,每个图在200k左右,是在页面没全部加载完时,又刷新页面造成的,不知道如何解决
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics