Using Java EE with Spring Boot


We have a Vaadin application that uses different features of Java EE (Interceptors, @Inject Instance<>, etc.) that we currently run in a TomEE application server. We’re trying to move this application to Spring Boot by doing as little change as possible.

As soon as I include the following dependency in the POM I get the following error when starting the Spring Boot app:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 :: Spring Boot ::        (v1.4.2.RELEASE)

Nov 16, 2016 12:07:29 PM org.springframework.boot.SpringApplication reportFailure
SEVERE: Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoSuchMethodError: org.apache.tomcat.util.scan.StandardJarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)V
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(
    at org.springframework.boot.SpringApplication.refresh(
    at org.springframework.boot.SpringApplication.refreshContext(
    at edu.self.vsb.VaadinSbApplication.main(
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.scan.StandardJarScanner.setJarScanFilter(Lorg/apache/tomcat/JarScanFilter;)V
    at org.springframework.boot.context.embedded.tomcat.SkipPatternJarScanner$Tomcat8TldSkipSetter.setSkipPattern(
    at org.springframework.boot.context.embedded.tomcat.SkipPatternJarScanner.setPatternToTomcat8SkipFilter(
    at org.springframework.boot.context.embedded.tomcat.SkipPatternJarScanner.<init>(
    at org.springframework.boot.context.embedded.tomcat.SkipPatternJarScanner.apply(
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.prepareContext(
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(
    ... 8 more

Is there a way to use Java EE with Spring Boot, or must I convert all Java EE code into Spring code?

Thanks a lot

You got a “java.lang.NoSuchMethodError” error,
I think it may be caused by incorrect jar file version.

Some code is calling a method of some class, but your app is using a jar file of the wrong version,
so it can find the class, but the method signature is different.

From your excetption stack info, I guess:
(1)the code who is calling is

(2)the class and method called by (1) is:
and the signature should be setJarScanFilter(org.apache.tomcat.JarScanFilter filter)

So, please check the source code of (1), and check the jar version and source code of (2),
see if they are compatible

Same error happened here:

You can read the answer, see if it can help you

Ok, thanks for you help. I managed to find and exclude the dependency that was causing the problem, but then another one caused the same problem, and then another one, etc. Maybe I should use another implementation of Java EE but I guess there will always be some kind of conflict…

What tool are you using to manage the jar depedency?
Maven? Ivy? or Gradle?

I’m using Maven.