gpt4 book ai didi

java - 我收到 exception-org.apache.catalina.core.ApplicationDispatcher.invoke 抛出异常 java.lang.IllegalStateException

转载 作者:IT老高 更新时间:2023-10-28 13:57:57 25 4
gpt4 key购买 nike

我的服务器日志中出现以下错误,

08-May-2018 12:00:07.460 SEVERE [https-jsse-nio-8443-exec-1] 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:624)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:211)
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.util.OnCommittedResponseWrapper.getWriter(OnCommittedResponseWrapper.java:149)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:118)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:111)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:176)
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.uncaughtException_html._jspService(uncaughtException_html.java:209)


08-May-2018 12:00:07.468 SEVERE [https-jsse-nio-8443-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [xyz] in context with path [] threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response] with root cause java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:624)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:211)
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.util.OnCommittedResponseWrapper.getWriter(OnCommittedResponseWrapper.java:149)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:118)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:111)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:176)
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.uncaughtException_html._jspService(uncaughtException_html.java:209)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

我不知道哪个方法抛出了这个错误,这个错误的原因是什么。实际上这个异常发生在我在tomcat中部署我的应用程序并尝试获取索引页面时(有时是第一次,有时是第二次,有时是第三次,无论何时到来。),实际上根据我在ssl时的配置已启用,当我部署我的应用程序并尝试获取欢迎页面 session 过期页面时,从现在开始,一旦我尝试获取其他一些页面,它就会引发上述异常。我正在使用 spring 4、spring security、maven、hibernate 4。任何人都可以帮助我吗?任何帮助都将得到应用。

web.xml

<web-app>
<display-name>Smart app Application</display-name>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-security.xml, /WEB-INF/app-servlet.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>

<servlet>
<servlet-name>app</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/WEB-INF/views/*</url-pattern>
</servlet-mapping>

<security-constraint>
<web-resource-collection>
<web-resource-name>application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index</welcome-file>
</welcome-file-list>

<session-config>
<session-timeout>50</session-timeout>
</session-config>
</web-app>

最佳答案

如果你有一个 SimpleMappingExceptionResolver 尝试检查你是否与你的 ControllerAdvice 注释类有冲突。异常只能在一个地方处理。

正如我所说,它可以由循环关系和 Jackason 作为序列化程序生成。在此您有一些选项,例如使用简化答案的 DTO 或用户 @JsonIgnore。

关于java - 我收到 exception-org.apache.catalina.core.ApplicationDispatcher.invoke 抛出异常 java.lang.IllegalStateException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50227896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com