org.apache.tomcat.JarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)V

今天在运行Spring Boot时,控制台报以下错误:


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.3.RELEASE)

2018-08-07 09:42:47.320  INFO 1944 --- [           main] com.th.SpringBootWebApplication          : Starting SpringBootWebApplication on SZ10PD0703 with PID 1944 (D:\workspace\springboot-war-tomcat\target\classes started by nicoletang in D:\workspace\springboot-war-tomcat)
2018-08-07 09:42:47.326  INFO 1944 --- [           main] com.th.SpringBootWebApplication          : No active profile set, falling back to default profiles: default
2018-08-07 09:42:47.420  INFO 1944 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@506ae4d4: startup date [Tue Aug 07 09:42:47 CST 2018]; root of context hierarchy
2018-08-07 09:42:50.072  WARN 1944 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoSuchMethodError: org.apache.tomcat.JarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)V
2018-08-07 09:42:50.090  INFO 1944 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-08-07 09:42:50.103 ERROR 1944 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoSuchMethodError: org.apache.tomcat.JarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)V
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.0.2.RELEASE.jar:5.0.2.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at com.th.SpringBootWebApplication.main(SpringBootWebApplication.java:20) [classes/:na]
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.JarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)V
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.configureTldSkipPatterns(TomcatServletWebServerFactory.java:244) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.prepareContext(TomcatServletWebServerFactory.java:203) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:173) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    ... 8 common frames omitted

原因:在项目中添加本地服务器,与提供的嵌入式tomcat服务器冲突。
解决:删除项目中的Tomcat服务器,运行就正常了.

06-Aug-2025 20:47:18.962 严重 [main] org.apache.catalina.startup.ContextConfig.processContextConfig 发生在 [31] 行 [78] 列 06-Aug-2025 20:47:18.962 警告 [main] org.apache.tomcat.util.digester.Digester.endElement 找不到匹配的规则[Context/Context/CookieProcessor] 06-Aug-2025 20:47:18.963 警告 [main] org.apache.tomcat.util.digester.Digester.endElement 找不到匹配的规则[Context/Context/Valve] 06-Aug-2025 20:47:18.963 警告 [main] org.apache.tomcat.util.digester.Digester.endElement 找不到匹配的规则[Context/Context/Manager] 06-Aug-2025 20:47:18.963 警告 [main] org.apache.tomcat.util.digester.Digester.endElement 找不到匹配的规则[Context/Context] 06-Aug-2025 20:47:18.976 严重 [main] org.apache.catalina.startup.ContextConfig.configureStart 由于之前的错误,标记当前应用程序不可用 06-Aug-2025 20:47:18.976 严重 [main] org.apache.catalina.core.StandardContext.startInternal 一个或多个组件将上下文标记为未正确配置 06-Aug-2025 20:47:18.977 严重 [main] org.apache.catalina.core.StandardContext.startInternal 由于之前的错误,Context[/host-manager]启动失败 06-Aug-2025 20:47:18.979 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/usr/local/tomcat/webapps/host-manager]的部署已在[19]毫秒内完成 06-Aug-2025 20:47:18.984 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"] 06-Aug-2025 20:47:19.008 信息 [main] org.apache.catalina.startup.Catalina.start [402]毫秒后服务器启动
最新发布
08-07
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值