Tomcat 9.0遇到java.lang.IllegalArgumentException: Invalid character found in the request target.

遇到这个问题一般是URL的不安全字符导致。例如下面这个URL。其中只用了 | 这个符号。导致发生了错误。

http://localhost:8080/SpringMVC/pages/back/message/message_delete.action?ids=1|2|3|4|5

网上提供了好几种解决方案:
1、stackoverflow里面这个回答和我的问题一样。但是当我修改完之后,在Tomcat9.0里并不能生效:https://stackoverflow.com/questions/41053653/tomcat-8-is-not-able-to-handle-get-request-with-in-query-parameters/44005213#44005213

2、替换为低版本的Tomcat,问题解决

3、对URL进行编码

4、使用指定的安全字符,参考:https://blog.csdn.net/ezreal_king/article/details/72654157


个人博客链接:xvanning.cn

你可能感兴趣的:(错误排查)