当前位置: 代码迷 >> 综合 >> 部署出错记录-org.apache.catalina.core.StandardContext.filterStart Exception starting filter
  详细解决方案

部署出错记录-org.apache.catalina.core.StandardContext.filterStart Exception starting filter

热度:22   发布时间:2023-12-26 07:07:08.0

springboot项目打成war包后就不能运行?

tomcat控制台显示

27-Jun-2019 14:52:26.488 信息 [localhost-startStop-1] org.apache.jasper.servlet.
TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs.Enable debug logging for this logger for a complete list of JARs that were scan
ned but no TLDs were found in them. Skipping unneeded JARs during scanning can i
mprove startup time and JSP compilation time.
2019-06-27 14:52:26,564 DEBUG (GenericFilterBean.java:241)- Filter 'tsoSessionFi
lter' configured for use
27-Jun-2019 14:52:26.567 严重 [localhost-startStop-1] org.apache.catalina.core.S
tandardContext.startInternal One or more Filters failed to start. Full details w
ill be found in the appropriate container log file
27-Jun-2019 14:52:26.569 严重 [localhost-startStop-1] org.apache.catalina.core.S
tandardContext.startInternal Context [/xdxm] startup failed due to previous erro
rs
2019-06-27 14:52:26,577 INFO (SessionFilter.java:340)- TsoSessionFilter閿?姣?
2019-06-27 14:52:26,580 INFO (ExecutorConfigurationSupport.java:208)- Shutting d
own ExecutorService 'applicationTaskExecutor'
27-Jun-2019 14:52:26.610 警告 [localhost-startStop-1] org.apache.catalina.loader
.WebappClassLoaderBase.clearReferencesJdbc The web application [xdxm] registeredthe JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when theweb application was stopped. To prevent a memory leak, the JDBC Driver has beenforcibly unregistered.
27-Jun-2019 14:52:26.630 信息 [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployWAR Deployment of web application archive [C:\Users\Administr
ator\Desktop\tomcat-SDK\webapps\xdxm.war] has finished in [29,816] ms
27-Jun-2019 14:52:26.640 信息 [main] org.apache.coyote.AbstractProtocol.start St
arting ProtocolHandler ["http-nio-8081"]
27-Jun-2019 14:52:26.709 信息 [main] org.apache.coyote.AbstractProtocol.start St
arting ProtocolHandler ["ajp-nio-8008"]
27-Jun-2019 14:52:26.717 信息 [main] org.apache.catalina.startup.Catalina.start
Server startup in 29977 ms

然后在localhost.log日志中出现如下错误提示

28-Jun-2019 10:25:23.592 信息 [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 2 Spring WebApplicationInitializers detected on classpath
28-Jun-2019 10:25:30.114 信息 [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext
28-Jun-2019 10:25:37.617 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [localSessionFilter]java.lang.AbstractMethodErrorat org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:112)at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4637)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5282)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985)at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:748)28-Jun-2019 10:25:37.633 信息 [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext

经发现异常提职localSessionFilter文件有问题于是找到

package com.hsit.filter;import java.io.IOException;import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;import org.apache.commons.lang3.StringUtils;public class LocalSessionFilter implements Filter{@SuppressWarnings("unused")private String loginUrl;private String mode;public LocalSessionFilter(String loginUrl,String mode) {this.loginUrl = loginUrl;this.mode = mode;}@Overridepublic void doFilter(ServletRequest req, ServletResponse res, FilterChain filter)throws IOException, ServletException {/**/HttpServletRequest httpRequest = (HttpServletRequest) req;HttpServletResponse httpResponse = (HttpServletResponse) res;String requestURI = httpRequest.getRequestURI();requestURI = requestURI.toLowerCase();if(requestURI.endsWith(".js")||requestURI.endsWith(".css")||requestURI.endsWith(".gif")||requestURI.endsWith(".bmp")||requestURI.endsWith(".jpg")||requestURI.endsWith(".png")||requestURI.endsWith(".htm")||requestURI.endsWith(".woff2")||requestURI.endsWith("404.html")||requestURI.endsWith("500.html")||requestURI.endsWith("503.html")){}else {HttpSession session = httpRequest.getSession(true);String personCode = session.getAttribute("personCode")==null?"":session.getAttribute("personCode").toString();if(StringUtils.isBlank(personCode)) {if("dev".equals(mode)) {//开发环境session.setAttribute("personCode", "10003");session.setAttribute("personName", "吴健");session.setAttribute("orgCode", "520101");session.setAttribute("orgName", "贵阳市市辖区就业小额贷款担保中心");session.setAttribute("deptCode", "5201010401");session.setAttribute("deptName", "办公室");} else {//生产环境要集成进统一平台里面,直接跳转到登录界面if(session.getAttribute("personCode")==null) {httpResponse.sendRedirect("/common/503.html");return;}}}}filter.doFilter(req,res);}}

又发现是java.lang.AbstractMethodError 错,该错误一般是混淆的错。 

发现 at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)

于是就重写了初始化方法

@Overridepublic void init(FilterConfig filterConfig) throws ServletException {}@Overridepublic void destroy() {}

重新打包部署就可以了 

 

  相关解决方案