Request processing failed; nested exception is java.lang.IllegalStateException: getOutputStream() has already been called for this response
问题分析:
在ServletRequest servletRequest中已经存在一个项目名称,此时,又用项目名称访问 http://localhost:8080/rent/pdf/preview rent这个名称已经在Application.yml中设置了,
这时会生成一个缓存在servletRequest中,访问就会有重复的/rent,就会报错
解决方案
清空servletRequest中存在的/rent缓存
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException { HttpServletResponse response = (HttpServletResponse) servletResponse; response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,Content-Type,XFILENAME,XFILECATEGORY,XFILESIZE"); logger.info("*********************************过滤器被使用**************************");
try {
filterChain.doFilter(servletRequest, servletResponse);
} catch (IllegalStateException e) {
servletRequest.getServletContext().removeAttribute("/rent");
} catch (ServletException e) {
e.printStackTrace();
} }
重点:
catch (IllegalStateException e) {
servletRequest.getServletContext().removeAttribute("/rent");
}
Request processing failed; nested exception is java.lang.IllegalStateException: getOutputStream() has already been called for this response的更多相关文章
- HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException
HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException type ...
- HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.
HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: ...
- Request processing failed; nested exception is java.lang.IllegalArgumentException: No converter found for return value of type: class cn.e3mall.pojo.TbItem
这个异常是缺少json相关的包 把以下依赖补上就好: <!-- Jackson Json处理工具包 --><dependency> <groupId>com.fas ...
- error:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
问题:调用的方法在一个接口类中,但我并没有注入那个被调用的类 解决:在UserEntity前加上@Autowired @Controller public class MainController { ...
- 报错:严重: Servlet.service() for servlet [springmvc] in context with path [ ] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
解决:service类或dao类需要@Autowired
- SSM框架报HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException错
如下图 一番排查之后发现原来是server层写漏注释了 粗心大意,一天内出现两次写漏注释,SSM框架有意思.
- 14- Servlet.service() for servlet [mvc-dispatcher] in context with path [/collegeservice] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root caus
有的service没有依赖注入:
- Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config解决
出现这个问题往往伴随 HTTP-500错误 报错信息: HTTP Status - Handler processing failed; nested exception is java.lang. ...
- org.springframework.web.util.NestedServletException : Handler processing failed; nested exception is java.lang.StackOverflowError
1 ,错误原因,循环冗余检查 result.setNearUsers(userList); Page page = new Page(); pag ...
随机推荐
- synchronized和lock以及synchronized和volatile的区别
synchronized和volatile区别synochronizd和volatile关键字区别: 1. volatile关键字解决的是变量在多个线程之间的可见性:而sychronized关键字解决 ...
- window.open() 打开的子页面 往主页面传参问题
<!--主页面的代码--><!DOCTYPE html> <html> <head> <meta charset="utf-8" ...
- C++ #define #if #ifndef 宏指令
不会用就直接复制粘贴 #define CURSOR(top,bottom) (((top)<<8)|(bottom)) #define mul(x1,x2) (x1*x2) #define ...
- python_09 文件处理流程,文件操作方法
文件处理流程 1.打开文件,得到文件句柄并赋值给一个变量 2.通过句柄对文件进行操作 3.关闭文件 f=open('test.txt',encoding='gbk') data = f.read() ...
- A bean with that name has already been defined in DataSourceConfiguration$Hikari.class
A bean with that name has already been defined in DataSourceConfiguration$Hikari.class 构建springcloud ...
- 最适合入门的Laravel中级教程(二)用户认证
之前的初级教程主要是学习简单的增删改查: 接着的中级教程的目标是在初级教程的基础上能写出更复杂更健壮的程序: 我们先来学习 laravel 的用户认证功能: 在现代网站中基本都有用户系统: 而我们每开 ...
- [Shell]Bash变量:自定义变量 & 环境变量 & 位置参数变量 & 预定义变量
--------------------------------------------------------------------------------- 变量是计算机内存的单元,其中存放的值 ...
- install mysql from source and troubleshooting example
I tried to install MySQL 5.7 from source file and upgrading previous MySQL version to the lastest 5. ...
- extentReport生成测试报告
之前在使用extentReport生成测试报告的时候,没有加载到相关的css,经检查为下面两个文件没有正确加载 后改变配置,加载本地的css和js文件,目前测试报告正确显示 1.创建TestNg的Re ...
- ORACLE查询内存溢出
首先我们来看一个带排序的查询,点击工具栏的显示包含实际的执行计划. 1 SELECT * FROM AdventureWorks2008R2.Person.Person WHERE FirstName ...