本文主要是介绍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 failedorg.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoSuchMethodError: org.apache.tomcat.JarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)Vat 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;)Vat 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服务器,运行就正常了.
这篇关于org.apache.tomcat.JarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)V的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!