首次使用idea从svn当下elicpse项目导入,配置完成运行出现这样的错误。
HTTP Status 500 - Filter execution threw an exception
type Exception report
message Filter execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Filter execution threw an exception
com.rongyi.common.XssFilter.doFilter(XssFilter.java:23)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
root cause
java.lang.ExceptionInInitializerError
com.rongyi.filter.CheckSessionOutFilter.doFilter(CheckSessionOutFilter.java:42)
com.rongyi.common.XssFilter.doFilter(XssFilter.java:23)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
root cause
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
java.lang.String.substring(String.java:1967)
com.rongyi.common.utils.Constant.getpath(Constant.java:82)
com.rongyi.common.utils.Constant.(Constant.java:69)
com.rongyi.filter.CheckSessionOutFilter.doFilter(CheckSessionOutFilter.java:42)
com.rongyi.common.XssFilter.doFilter(XssFilter.java:23)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
note The full stack trace of the root cause is available in the Apache Tomcat/9.0.0.M9 logs.
Apache Tomcat/9.0.0.M9
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- spring框架必须定义ContextLoaderListener,在启动Web容器时,自动装配Spring applicationContext.xml的配置信息 -->
org.springframework.web.context.ContextLoaderListener
<!-- 指定Spring上下文配置文件 -->
contextConfigLocation
classpath*:applicationContext.xml
spring.profiles.active
production
Dispatcher
org.springframework.web.servlet.DispatcherServlet
<!-- 指定SpringMVC配置文件 -->
contextConfigLocation
/WEB-INF/springmvc.xml
<!-- 指定请求的后缀,可以随意写,这里用.html作为请求后缀 -->
Dispatcher
<!-- *.html -->
/
<!-- 编码格式为UTF-8 -->
encodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
forceEncoding
true
encodingFilter
/*
<!-- 过滤sql注入,对传入的参数过滤特殊字符等 -->
XssFilter
com.rongyi.common.XssFilter
XssFilter
/*
<!-- 检查session是否过期filter -->
CheckSessionFilter
com.rongyi.filter.CheckSessionOutFilter
CheckSessionFilter
/*
index.jsp
请帮帮忙跪求。。。