Spring Boot Error: java.lang.NoSuchMethodError: org.apache.tomcat.util.scan.StandardJarScanner.setJarScanFilter
I had the exact same issue with Spring boot
and the embedded tomcat server
.
How i fixed it
After many hours of hit and trial, running and re-running i found that i had initially added local tomcat server to my project which was conflicting with the embedded tomcat server that Spring Boot
provides. After removing the Tomcat Server from the projects build path running Spring Boot
was like a charm.
Just right click the project
Build Path --> Configure Build Path --> Libraries(Tab)
and remove your Tomcat server runtime if you have added one by mistake. You should be good to go now.
I tried to run your code in my local pc and there was an error similar like what happened in your place. And, these are the steps that I did to remove those error.
Update the spring boot version
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.1.12.RELEASE</version> </parent>
Update your main class as
@SpringBootApplication
annotation only exists after spring boot version 1.2.0@Configuration @EnableAutoConfiguration @ComponentScan public class Application { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); System.out.println("NinjaSquare server up and running with Spring Boot!"); System.out.println("Let's inspect the beans provided by Spring Boot:"); String[] beanNames = ctx.getBeanDefinitionNames(); Arrays.sort(beanNames); for (String beanName : beanNames) { System.out.println(beanName); } } }
Remove the "
webapp-runner
" dependency frompom.xml
as this library also has classorg.apache.catalina.core.StandardContext
which conflicted with the one from embedded tomcat library.<dependency> <groupId>com.github.jsimone</groupId> <artifactId>webapp-runner</artifactId> <version>${com.github.jsimone.version}</version> <scope>provided</scope> </dependency>
Yes, remove those lines ;)
Run the application and then, profit ?