Why does Maven "includes" in parent excluded dependencies - maven

Why does Maven not inherit excluded dependencies?
For Example, if I use a parent POM and a dependency:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-spring</artifactId>
</dependency>
</dependencies>
And spring-boot-starter-parent excludes for activemq-spring commons-logging:commons-logging`.
The dependency tree looks like this:
[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) # MavenTest ---
[INFO] org.example:MavenTest:pom:1.0-SNAPSHOT
[INFO] \- org.apache.activemq:activemq-spring:jar:5.16.5:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] +- org.apache.xbean:xbean-spring:jar:4.21:compile
[INFO] +- org.apache.activemq:activemq-broker:jar:5.16.5:compile
[INFO] | +- org.apache.activemq:activemq-client:jar:5.16.5:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO] | | +- org.fusesource.hawtbuf:hawtbuf:jar:1.11:compile
[INFO] | | \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile
[INFO] | +- org.apache.activemq:activemq-openwire-legacy:jar:5.16.5:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4.2:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile
[INFO] +- org.apache.activemq:activemq-pool:jar:5.16.5:compile
[INFO] | \- org.apache.activemq:activemq-jms-pool:jar:5.16.5:compile
[INFO] +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] \- org.apache.commons:commons-pool2:jar:2.11.1:compile
If I now add a <dependencyManagement> and exclude another dependency:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-spring</artifactId>
<version>${activemq.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
The dependency tree contains in parent excluded commons-logging:commons-logging and does not contain org.slf4j:slf4j-api.
[INFO] \- org.apache.activemq:activemq-spring:jar:5.16.5:compile
[INFO] +- org.apache.xbean:xbean-spring:jar:4.21:compile
[INFO] | \- commons-logging:commons-logging:jar:1.0.3:compile
[INFO] +- org.apache.activemq:activemq-broker:jar:5.16.5:compile
[INFO] | +- org.apache.activemq:activemq-client:jar:5.16.5:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO] | | +- org.fusesource.hawtbuf:hawtbuf:jar:1.11:compile
[INFO] | | \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile
[INFO] | +- org.apache.activemq:activemq-openwire-legacy:jar:5.16.5:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4.2:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile
[INFO] +- org.apache.activemq:activemq-pool:jar:5.16.5:compile
[INFO] | \- org.apache.activemq:activemq-jms-pool:jar:5.16.5:compile
[INFO] +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] \- org.apache.commons:commons-pool2:jar:2.11.1:compile
I was expecting that both exclusions, commons-logging:commons-logging and org.slf4j:slf4j-api will be excluded. But this is not the case.
Why does Maven not inherit parent exclusion?

Related

Issues with Upgrading Spring boot from 2.2.2.Release to 2.4.2 Rlease

We have an existing application which is working fine with the SpringBoot 2.2.2.RELEASE. Now we tried to upgrade it to the SpringBoot 2.4.2 version and application is not getting started and throws the following error. In the classpath I could see only one spring-webmvc-5.3.2.jar file.
Below is the pom.xml for the referance:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.test</groupId>
<artifactId>test-api</artifactId>
<version>1.0</version>
<name>Microservice</name>
<description>Microservice</description>
<packaging>jar</packaging>
<properties>
<java.version>13</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth</artifactId>
<version>3.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<!-- Needed to produce both an Executable and Importable JAR. Two jars
will now be produced -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.25.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.25.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.25.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-data-rest</artifactId>
<version>1.5.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.datadoghq/dd-trace-api -->
<dependency>
<groupId>com.datadoghq</groupId>
<artifactId>dd-trace-api</artifactId>
<version>0.66.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.13.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
</dependencies>
<build>
<finalName>test-api</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- Needed to produce both an Executable and Importable JAR. Two jars
will now be produced -->
<executions>
<execution>
<id>repackage</id>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.lambda$addResourceHandlers$0(WebMvcAutoConfiguration.java:411)
The following method did not exist:
'org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.addResourceLocations(org.springframework.core.io.Resource[])'
The method's class, org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration, is available from the following locations:
jar:file:/C:/Users/test/.m2/repository/org/springframework/spring-webmvc/5.3.2/spring-webmvc-5.3.2.jar!/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.class
The class hierarchy was loaded from the following locations:
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration: file:/C:/Users/test/.m2/repository/org/springframework/spring-webmvc/5.3.2/spring-webmvc-5.3.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration
Dependency Tree:
C:\Users\test-api>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.test:test-api >------------------
[INFO] Microservice 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) # test-api ---
[WARNING] The POM for org.apache.maven:maven-artifact:jar:3.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] com.fmr.AP135913:test-api:jar:1.0
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.4.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.4.2:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.4.2:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile
[INFO] | | \- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.glassfish:jakarta.el:jar:3.0.3:compile
[INFO] | \- org.hibernate.validator:hibernate-validator:jar:6.1.7.Final:compile
[INFO] | +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] | \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.4.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.4.2:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.3:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.3:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.4.2:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.41:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.41:compile
[INFO] | +- org.springframework:spring-web:jar:5.3.2:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.3.2:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.3.2:compile
[INFO] | +- org.springframework:spring-aop:jar:5.3.2:compile
[INFO] | \- org.springframework:spring-expression:jar:5.3.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:2.4.2:compile
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.13.3:compile
[INFO] | | \- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] | +- org.apache.logging.log4j:log4j-core:jar:2.13.3:compile
[INFO] | +- org.apache.logging.log4j:log4j-jul:jar:2.13.3:compile
[INFO] | \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] +- org.springframework.boot:spring-boot-configuration-processor:jar:2.4.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.4.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.4.2:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.6:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.4.2:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:3.4.5:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.3.2:compile
[INFO] | +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] | +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.4.27.Final:compile
[INFO] | | +- org.javassist:javassist:jar:3.27.0-GA:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.1.3.Final:compile
[INFO] | | +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.4.2:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.4.2:compile
[INFO] | | \- org.springframework:spring-orm:jar:5.3.2:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.3.2:compile
[INFO] +- org.mariadb.jdbc:mariadb-java-client:jar:2.7.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.3:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.11.3:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.4.2:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.4.2:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.4.2:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:compile
[INFO] | | \- net.minidev:json-smart:jar:2.3:compile
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:compile
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] | +- org.assertj:assertj-core:jar:3.18.1:test
[INFO] | +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.7.0:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.7.0:test
[INFO] | | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | | \- org.junit.platform:junit-platform-commons:jar:1.7.0:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.7.0:test
[INFO] | | \- org.junit.jupiter:junit-jupiter-engine:jar:5.7.0:test
[INFO] | | \- org.junit.platform:junit-platform-engine:jar:1.7.0:test
[INFO] | +- org.mockito:mockito-core:jar:3.6.28:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.10.19:test
[INFO] | | \- org.objenesis:objenesis:jar:3.0.1:test
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.6.28:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:5.3.2:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.3.2:compile
[INFO] | +- org.springframework:spring-test:jar:5.3.2:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.7.0:test
[INFO] +- org.springframework.kafka:spring-kafka:jar:2.6.5:compile
[INFO] | +- org.springframework:spring-context:jar:5.3.2:compile
[INFO] | +- org.springframework:spring-messaging:jar:5.3.2:compile
[INFO] | +- org.springframework:spring-tx:jar:5.3.2:compile
[INFO] | +- org.springframework.retry:spring-retry:jar:1.3.1:compile
[INFO] | \- org.apache.kafka:kafka-clients:jar:2.6.0:compile
[INFO] | +- com.github.luben:zstd-jni:jar:1.4.4-7:compile
[INFO] | +- org.lz4:lz4-java:jar:1.7.1:compile
[INFO] | \- org.xerial.snappy:snappy-java:jar:1.1.7.3:compile
[INFO] +- io.grpc:grpc-netty:jar:1.25.0:compile
[INFO] | +- io.grpc:grpc-core:jar:1.25.0:compile (version selected from constraint [1.25.0,1.25.0])
[INFO] | | +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] | | +- com.google.android:annotations:jar:4.1.1.4:compile
[INFO] | | +- io.perfmark:perfmark-api:jar:0.19.0:compile
[INFO] | | +- io.opencensus:opencensus-api:jar:0.21.0:compile
[INFO] | | \- io.opencensus:opencensus-contrib-grpc-metrics:jar:0.21.0:compile
[INFO] | +- io.netty:netty-codec-http2:jar:4.1.55.Final:compile
[INFO] | | \- io.netty:netty-codec-http:jar:4.1.55.Final:compile
[INFO] | \- io.netty:netty-handler-proxy:jar:4.1.55.Final:compile
[INFO] | \- io.netty:netty-codec-socks:jar:4.1.55.Final:compile
[INFO] +- io.grpc:grpc-protobuf:jar:1.25.0:compile
[INFO] | +- io.grpc:grpc-api:jar:1.25.0:compile
[INFO] | | +- io.grpc:grpc-context:jar:1.25.0:compile
[INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.3.3:compile
[INFO] | | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:3.10.0:compile
[INFO] | +- com.google.guava:guava:jar:28.1-android:compile
[INFO] | | +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] | | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] | | +- org.checkerframework:checker-compat-qual:jar:2.5.5:compile
[INFO] | | \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] | +- com.google.api.grpc:proto-google-common-protos:jar:1.12.0:compile
[INFO] | \- io.grpc:grpc-protobuf-lite:jar:1.25.0:compile
[INFO] +- io.grpc:grpc-stub:jar:1.25.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.4.2:compile
[INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.4.2:compile
[INFO] | | \- org.springframework.boot:spring-boot-actuator:jar:2.4.2:compile
[INFO] | \- io.micrometer:micrometer-core:jar:1.6.2:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] | \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.4.2:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.4.2:compile
[INFO] | \- org.springframework.boot:spring-boot-autoconfigure:jar:2.4.2:compile
[INFO] +- org.hibernate:hibernate-jpamodelgen:jar:5.4.27.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.3:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.11:compile
[INFO] | \- com.sun.activation:jakarta.activation:jar:1.2.2:runtime
[INFO] +- org.springdoc:springdoc-openapi-ui:jar:1.5.2:compile
[INFO] | +- org.springdoc:springdoc-openapi-webmvc-core:jar:1.5.2:compile
[INFO] | | \- org.springdoc:springdoc-openapi-common:jar:1.5.2:compile
[INFO] | | +- io.swagger.core.v3:swagger-models:jar:2.1.6:compile
[INFO] | | +- io.swagger.core.v3:swagger-annotations:jar:2.1.6:compile
[INFO] | | +- io.swagger.core.v3:swagger-integration:jar:2.1.6:compile
[INFO] | | | \- io.swagger.core.v3:swagger-core:jar:2.1.6:compile
[INFO] | | +- io.github.classgraph:classgraph:jar:4.8.69:compile
[INFO] | | \- org.apache.commons:commons-lang3:jar:3.11:compile
[INFO] | +- org.webjars:swagger-ui:jar:3.38.0:compile
[INFO] | \- org.webjars:webjars-locator-core:jar:0.46:compile
[INFO] +- org.springdoc:springdoc-openapi-data-rest:jar:1.5.2:compile
[INFO] | +- org.springdoc:springdoc-openapi-hateoas:jar:1.5.2:compile
[INFO] | | \- org.springframework.hateoas:spring-hateoas:jar:1.2.3:compile
[INFO] | \- org.springframework.data:spring-data-rest-core:jar:3.4.2:compile
[INFO] | +- org.springframework.plugin:spring-plugin-core:jar:2.0.0.RELEASE:compile
[INFO] | \- org.atteo:evo-inflector:jar:1.2.2:compile
[INFO] +- com.datadoghq:dd-trace-api:jar:0.66.0:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-sleuth:jar:3.0.0:compile
[INFO] | +- org.springframework.cloud:spring-cloud-starter:jar:3.0.0:compile
[INFO] | | +- org.springframework.cloud:spring-cloud-context:jar:3.0.0:compile
[INFO] | | | \- org.springframework.security:spring-security-crypto:jar:5.4.2:compile
[INFO] | | +- org.springframework.cloud:spring-cloud-commons:jar:3.0.0:compile
[INFO] | | \- org.springframework.security:spring-security-rsa:jar:1.0.9.RELEASE:compile
[INFO] | | \- org.bouncycastle:bcpkix-jdk15on:jar:1.64:compile
[INFO] | | \- org.bouncycastle:bcprov-jdk15on:jar:1.64:compile
[INFO] | +- org.springframework.cloud:spring-cloud-sleuth-autoconfigure:jar:3.0.0:compile
[INFO] | | +- org.springframework.cloud:spring-cloud-sleuth-instrumentation:jar:3.0.0:compile
[INFO] | | | \- org.springframework.cloud:spring-cloud-sleuth-api:jar:3.0.0:compile
[INFO] | | \- org.aspectj:aspectjrt:jar:1.9.6:compile
[INFO] | \- org.springframework.cloud:spring-cloud-sleuth-brave:jar:3.0.0:compile
[INFO] | +- io.zipkin.brave:brave:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-context-slf4j:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-messaging:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-rpc:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-spring-rabbit:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-kafka-clients:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-kafka-streams:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-httpclient:jar:5.13.2:compile
[INFO] | | \- io.zipkin.brave:brave-instrumentation-http:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-httpasyncclient:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-jms:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-mongodb:jar:5.13.2:compile
[INFO] | +- io.zipkin.aws:brave-propagation-aws:jar:0.21.3:compile
[INFO] | \- io.zipkin.reporter2:zipkin-reporter-metrics-micrometer:jar:2.16.1:compile
[INFO] | \- io.zipkin.reporter2:zipkin-reporter:jar:2.16.1:compile
[INFO] | \- io.zipkin.zipkin2:zipkin:jar:2.23.0:compile
[INFO] +- org.redisson:redisson:jar:3.13.2:compile
[INFO] | +- io.netty:netty-common:jar:4.1.55.Final:compile
[INFO] | +- io.netty:netty-codec:jar:4.1.55.Final:compile
[INFO] | +- io.netty:netty-buffer:jar:4.1.55.Final:compile
[INFO] | +- io.netty:netty-transport:jar:4.1.55.Final:compile
[INFO] | | \- io.netty:netty-resolver:jar:4.1.55.Final:compile
[INFO] | +- io.netty:netty-resolver-dns:jar:4.1.55.Final:compile
[INFO] | | \- io.netty:netty-codec-dns:jar:4.1.55.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.55.Final:compile
[INFO] | +- javax.cache:cache-api:jar:1.1.1:compile
[INFO] | +- io.projectreactor:reactor-core:jar:3.4.1:compile
[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] | +- io.reactivex.rxjava2:rxjava:jar:2.2.20:compile
[INFO] | +- org.jboss.marshalling:jboss-marshalling-river:jar:2.0.9.Final:compile
[INFO] | | \- org.jboss.marshalling:jboss-marshalling:jar:2.0.9.Final:compile
[INFO] | +- org.yaml:snakeyaml:jar:1.27:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.11.3:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.10.19:compile
[INFO] | \- org.jodd:jodd-bean:jar:5.0.13:compile
[INFO] | \- org.jodd:jodd-core:jar:5.0.13:compile
[INFO] \- commons-codec:commons-codec:jar:1.15:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.008 s
[INFO] Finished at: 2021-01-25T11:32:30-05:00
[INFO] ------------------------------------------------------------------------
C:\Users\test-api>
As mentioned here https://github.com/spring-projects/spring-boot/issues/25049#event-4265028906
Importing spring-cloud-sleuth as a BOM for dependency management is very suspect.
After replacing this
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth</artifactId>
<version>3.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
with this one it is working fine.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I also got issue while upgrading spring-boot-starter-parent to 2.4.5 i had upgraded below dependency and added below property and the spring boot application works fine now.
Pom.xml changes:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>3.0.3</version>
</dependency>
in application.yml add below property
spring.cloud.config.enabled: false

Error while running spring boot on external tomcat inside docker container

My spring-boot service(in a centos 7 server) runs ok on docker with embedded tomcat. But when I tried to deploy the .war file inside a docker container with a tomcat, it fails. I followed the steps described in the link: https://dzone.com/articles/spring-boot-with-external-tomcat
What might the problem and how to solve this?
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.myservice</groupId>
<artifactId>myservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>myservice</name>
<description>Demo project for Spring Boot</description>
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<!-- start of security dependencies -->
<!-- end of security dependencies -->
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<!-- <version>Camden.SR5</version> -->
<version>Finchley.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Dockerfile:
FROM tomcat:8-jre8
ADD target/*.war /usr/local/tomcat/webapps/
CMD ["catalina.sh", "run"]
Docker Log:
2019-10-15 05:13:49.205 INFO [myservice,,,] 1 --- [ost-startStop-1] com.myservice.service.Application : Started Application in 13.674 seconds (JVM running for 20.222)
15-Oct-2019 05:13:49.263 INFO [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 scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
15-Oct-2019 05:13:49.295 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file
15-Oct-2019 05:13:49.296 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/myservice-0.0.1-SNAPSHOT] startup failed due to previous errors
Tomcat Log:
# cat localhost.2019-10-15.log
15-Oct-2019 05:13:35.357 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 2 Spring WebApplicationInitializers detected on classpath
15-Oct-2019 05:13:42.403 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext
15-Oct-2019 05:13:49.295 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [controllerMethodInterceptor]
java.lang.AbstractMethodError
at 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:4615)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5262)
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:744)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:980)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1851)
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)
15-Oct-2019 05:13:49.302 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
15-Oct-2019 05:13:50.086 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
15-Oct-2019 05:13:50.086 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
15-Oct-2019 05:13:50.088 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker#1e2bc9bf')
Edit
mvn dependency:tree
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.myservice:myservice:war:0.0.1-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.exclusions.exclusion.artifactId' for org.quartz-scheduler:quartz:jar with value '*' does not match a valid id pattern. # org.springframework.boot:spring-boot-dependencies:2.1.6.RELEASE, /root/.m2/repository/org/springframework/boot/spring-boot-dependencies/2.1.6.RELEASE/spring-boot-dependencies-2.1.6.RELEASE.pom, line 2619, column 25
[WARNING] 'dependencyManagement.dependencies.dependency.exclusions.exclusion.artifactId' for com.netflix.eureka:eureka-core:jar with value '*' does not match a valid id pattern. # org.springframework.cloud:spring-cloud-netflix-dependencies:2.0.0.RELEASE, /root/.m2/repository/org/springframework/cloud/spring-cloud-netflix-dependencies/2.0.0.RELEASE/spring-cloud-netflix-dependencies-2.0.0.RELEASE.pom, line 251, column 19
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myservice 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.1.1:tree (default-cli) # myservice ---
[INFO] com.myservice:myservice:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.1.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.1.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:5.1.8.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.6.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.2:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.26:compile
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | +- org.springframework:spring-core:jar:5.1.8.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.1.8.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.6.RELEASE:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.21:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.21:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.21:provided
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.6.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.1.6.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.6.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:3.11.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.13:compile
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.13:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.1.8.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.2:test
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.6.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.9:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.9:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.9:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.17.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | | \- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | +- org.springframework:spring-web:jar:5.1.8.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.1.8.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.1.8.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.1.8.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.6.RELEASE:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:3.2.0:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.1.8.RELEASE:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.3:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.3.10.Final:compile
[INFO] | | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | | +- org.javassist:javassist:jar:3.23.2-GA:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] | | +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.1.9.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.1.9.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.1.8.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:5.1.8.RELEASE:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.1.8.RELEASE:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.8:compile
[INFO] +- org.postgresql:postgresql:jar:42.2.5:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-aop:jar:2.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.1.8.RELEASE:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.9.4:compile
[INFO] +- io.springfox:springfox-swagger2:jar:2.9.2:compile
[INFO] | +- io.swagger:swagger-annotations:jar:1.5.20:compile
[INFO] | +- io.swagger:swagger-models:jar:1.5.20:compile
[INFO] | +- io.springfox:springfox-spi:jar:2.9.2:compile
[INFO] | | \- io.springfox:springfox-core:jar:2.9.2:compile
[INFO] | +- io.springfox:springfox-schema:jar:2.9.2:compile
[INFO] | +- io.springfox:springfox-swagger-common:jar:2.9.2:compile
[INFO] | +- io.springfox:springfox-spring-web:jar:2.9.2:compile
[INFO] | +- com.google.guava:guava:jar:20.0:compile
[INFO] | +- com.fasterxml:classmate:jar:1.4.0:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.26:compile
[INFO] | +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] | +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO] | \- org.mapstruct:mapstruct:jar:1.2.0.Final:compile
[INFO] +- io.springfox:springfox-swagger-ui:jar:2.9.2:compile
[INFO] +- commons-codec:commons-codec:jar:1.12:compile
[INFO] +- org.modelmapper:modelmapper:jar:0.7.4:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] +- org.springframework.cloud:spring-cloud-config-client:jar:2.0.0.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-commons:jar:2.0.0.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-crypto:jar:5.1.5.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-context:jar:2.0.0.RELEASE:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.9:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:jar:2.0.0.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-starter:jar:2.0.0.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-rsa:jar:1.0.5.RELEASE:compile
[INFO] | | \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
[INFO] | | \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
[INFO] | +- org.springframework.cloud:spring-cloud-netflix-core:jar:2.0.0.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-netflix-eureka-client:jar:2.0.0.RELEASE:compile
[INFO] | +- com.netflix.eureka:eureka-client:jar:1.9.2:compile
[INFO] | | +- org.codehaus.jettison:jettison:jar:1.3.7:runtime
[INFO] | | | \- stax:stax-api:jar:1.0.1:runtime
[INFO] | | +- com.netflix.netflix-commons:netflix-eventbus:jar:0.3.0:runtime
[INFO] | | | +- com.netflix.netflix-commons:netflix-infix:jar:0.3.0:runtime
[INFO] | | | | +- commons-jxpath:commons-jxpath:jar:1.3:runtime
[INFO] | | | | +- joda-time:joda-time:jar:2.10.2:runtime
[INFO] | | | | +- org.antlr:antlr-runtime:jar:3.4:runtime
[INFO] | | | | | \- org.antlr:stringtemplate:jar:3.2.1:runtime
[INFO] | | | | \- com.google.code.gson:gson:jar:2.8.5:runtime
[INFO] | | | \- org.apache.commons:commons-math:jar:2.2:runtime
[INFO] | | +- com.netflix.archaius:archaius-core:jar:0.7.6:compile
[INFO] | | +- javax.ws.rs:jsr311-api:jar:1.1.1:runtime
[INFO] | | +- com.netflix.servo:servo-core:jar:0.12.21:runtime
[INFO] | | +- com.sun.jersey:jersey-core:jar:1.19.1:runtime
[INFO] | | +- com.sun.jersey:jersey-client:jar:1.19.1:runtime
[INFO] | | +- com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.1:runtime
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.9:runtime
[INFO] | | | \- org.apache.httpcomponents:httpcore:jar:4.4.11:runtime
[INFO] | | +- com.google.inject:guice:jar:4.1.0:runtime
[INFO] | | | +- javax.inject:javax.inject:jar:1:runtime
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:runtime
[INFO] | | \- com.github.vlsi.compactmap:compactmap:jar:1.2.1:runtime
[INFO] | | \- com.github.andrewoma.dexx:dexx-collections:jar:0.2:runtime
[INFO] | +- com.netflix.eureka:eureka-core:jar:1.9.2:compile
[INFO] | | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:runtime
[INFO] | | +- javax.xml.stream:stax-api:jar:1.0-2:runtime
[INFO] | | \- org.codehaus.woodstox:stax2-api:jar:3.1.4:runtime
[INFO] | +- org.springframework.cloud:spring-cloud-starter-netflix-archaius:jar:2.0.0.RELEASE:compile
[INFO] | | +- org.springframework.cloud:spring-cloud-netflix-ribbon:jar:2.0.0.RELEASE:compile
[INFO] | | +- org.springframework.cloud:spring-cloud-netflix-archaius:jar:2.0.0.RELEASE:compile
[INFO] | | \- commons-configuration:commons-configuration:jar:1.8:compile
[INFO] | | \- commons-lang:commons-lang:jar:2.6:compile
[INFO] | +- org.springframework.cloud:spring-cloud-starter-netflix-ribbon:jar:2.0.0.RELEASE:compile
[INFO] | | +- com.netflix.ribbon:ribbon:jar:2.2.5:compile
[INFO] | | | +- com.netflix.ribbon:ribbon-transport:jar:2.2.5:runtime
[INFO] | | | | +- io.reactivex:rxnetty-contexts:jar:0.4.9:runtime
[INFO] | | | | \- io.reactivex:rxnetty-servo:jar:0.4.9:runtime
[INFO] | | | +- com.netflix.hystrix:hystrix-core:jar:1.5.12:runtime
[INFO] | | | | \- org.hdrhistogram:HdrHistogram:jar:2.1.9:runtime
[INFO] | | | \- io.reactivex:rxnetty:jar:0.4.9:runtime
[INFO] | | | +- io.netty:netty-codec-http:jar:4.1.36.Final:runtime
[INFO] | | | | +- io.netty:netty-common:jar:4.1.36.Final:runtime
[INFO] | | | | +- io.netty:netty-buffer:jar:4.1.36.Final:runtime
[INFO] | | | | +- io.netty:netty-transport:jar:4.1.36.Final:runtime
[INFO] | | | | | \- io.netty:netty-resolver:jar:4.1.36.Final:runtime
[INFO] | | | | +- io.netty:netty-codec:jar:4.1.36.Final:runtime
[INFO] | | | | \- io.netty:netty-handler:jar:4.1.36.Final:runtime
[INFO] | | | \- io.netty:netty-transport-native-epoll:jar:4.1.36.Final:runtime
[INFO] | | | \- io.netty:netty-transport-native-unix-common:jar:4.1.36.Final:runtime
[INFO] | | +- com.netflix.ribbon:ribbon-core:jar:2.2.5:compile
[INFO] | | +- com.netflix.ribbon:ribbon-httpclient:jar:2.2.5:compile
[INFO] | | | +- commons-collections:commons-collections:jar:3.2.2:runtime
[INFO] | | | \- com.netflix.netflix-commons:netflix-commons-util:jar:0.3.0:runtime
[INFO] | | +- com.netflix.ribbon:ribbon-loadbalancer:jar:2.2.5:compile
[INFO] | | | \- com.netflix.netflix-commons:netflix-statistics:jar:0.1.1:runtime
[INFO] | | \- io.reactivex:rxjava:jar:1.3.8:compile
[INFO] | +- com.netflix.ribbon:ribbon-eureka:jar:2.2.5:compile
[INFO] | \- com.thoughtworks.xstream:xstream:jar:1.4.10:compile
[INFO] | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.395s
[INFO] Finished at: Tue Oct 15 15:17:39 UTC 2019
[INFO] Final Memory: 25M/363M
[INFO] ------------------------------------------------------------------------
There are dependencies to apache-tomcat 9.0.21 in your project. This suggest that at least some modules depend on tomcat 9 directly or on servlet 4.0 specification.
Try to upgrade your docker image to Tomcat 9.

javax.persistence.PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType

Im trying to run a simple JPA spring web page, but i'm having trouble with getting it to recognize javax.persistence, or maybe I have conflicts of imports.
So far I have tried removing many maven dependencies to try finding a conflict as a few other stackoverflow answers involved this and I was unable to. I also tried adding the persistence api dependency but it did not help
These are my dependencies in pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
</dependencies>
and this is the error I am getting when running the program
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.<init>(PersistenceAnnotationBeanPostProcessor.java:665)
The following method did not exist:
javax.persistence.PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType;
The method's class, javax.persistence.PersistenceContext, is available from the following locations:
jar:file:/C:/Users/hicks/IdeaProjects/CodeSite/lib/javax.persistence.jar!/javax/persistence/PersistenceContext.class
jar:file:/C:/Users/hicks/.m2/repository/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2.jar!/javax/persistence/PersistenceContext.class
It was loaded from the following location:
file:/C:/Users/hicks/IdeaProjects/CodeSite/lib/javax.persistence.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.persistence.PersistenceContext
Running maven dependency:tree -Dverbose returns this tree, which shows only one occurrence of javax.persistence-api:
[INFO] ------------------------------------------------------------------------
[INFO] Building codesite 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.1.1:tree (default-cli) # demo ---
[INFO] Verbose not supported since maven-dependency-plugin 3.0
[INFO] jacob:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.1.4.RELEASE:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.4.RELEASE:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:3.2.0:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.1.6.RELEASE:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.3:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.3.9.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | | +- org.javassist:javassist:jar:3.23.1-GA:compile
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.12:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] | | +- com.fasterxml:classmate:jar:1.4.0:compile
[INFO] | | +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.1.6.RELEASE:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.15:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.1.4.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.4.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.2:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.26:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.4.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.4.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.17:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.17:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.17:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.16.Final:compile
[INFO] | | \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | +- org.springframework:spring-web:jar:5.1.6.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.1.6.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.1.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.4.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.1.4.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.4.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:3.11.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.12:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:5.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-test:jar:5.1.6.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.2:test
[INFO] +- commons-io:commons-io:jar:2.1:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO] +- io.projectreactor:reactor-test:jar:3.2.8.RELEASE:test
[INFO] | \- io.projectreactor:reactor-core:jar:3.2.8.RELEASE:compile
[INFO] | \- org.reactivestreams:reactive-streams:jar:1.0.2:compile
[INFO] +- org.springframework.data:spring-data-commons:jar:2.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:5.1.6.RELEASE:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.26:compile
[INFO] +- org.springframework.data:spring-data-jpa:jar:2.1.6.RELEASE:runtime
[INFO] | +- org.springframework:spring-orm:jar:5.1.6.RELEASE:runtime
[INFO] | +- org.springframework:spring-context:jar:5.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:5.1.6.RELEASE:compile
[INFO] | \- org.aspectj:aspectjrt:jar:1.9.2:runtime
[INFO] +- org.springframework.session:spring-session-core:jar:2.1.5.RELEASE:compile
[INFO] | \- org.springframework:spring-jcl:jar:5.1.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.1.4.RELEASE:runtime
[INFO] | +- org.springframework.boot:spring-boot:jar:2.1.4.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:2.1.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:2.1.4.RELEASE:compile
[INFO] | | \- io.projectreactor.netty:reactor-netty:jar:0.8.6.RELEASE:compile
[INFO] | | +- io.netty:netty-codec-http:jar:4.1.34.Final:compile
[INFO] | | | +- io.netty:netty-common:jar:4.1.34.Final:compile
[INFO] | | | +- io.netty:netty-buffer:jar:4.1.34.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.34.Final:compile
[INFO] | | | | \- io.netty:netty-resolver:jar:4.1.34.Final:compile
[INFO] | | | \- io.netty:netty-codec:jar:4.1.34.Final:compile
[INFO] | | +- io.netty:netty-codec-http2:jar:4.1.34.Final:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.34.Final:compile
[INFO] | | +- io.netty:netty-handler-proxy:jar:4.1.34.Final:compile
[INFO] | | | \- io.netty:netty-codec-socks:jar:4.1.34.Final:compile
[INFO] | | \- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.34.Final:compile
[INFO] | | \- io.netty:netty-transport-native-unix-common:jar:4.1.34.Final:compile
[INFO] | +- org.springframework:spring-webflux:jar:5.1.6.RELEASE:compile
[INFO] | \- org.synchronoss.cloud:nio-multipart-parser:jar:1.1.0:compile
[INFO] | \- org.synchronoss.cloud:nio-stream-storage:jar:1.1.3:compile
[INFO] +- de.codecentric:spring-boot-admin-starter-server:jar:2.1.4:compile
[INFO] | +- de.codecentric:spring-boot-admin-server:jar:2.1.4:compile
[INFO] | | \- io.projectreactor.addons:reactor-extra:jar:3.2.2.RELEASE:compile
[INFO] | +- de.codecentric:spring-boot-admin-server-ui:jar:2.1.4:compile
[INFO] | \- de.codecentric:spring-boot-admin-server-cloud:jar:2.1.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.1.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.1.4.RELEASE:compile
[INFO] | | \- org.springframework.boot:spring-boot-actuator:jar:2.1.4.RELEASE:compile
[INFO] | \- io.micrometer:micrometer-core:jar:1.1.4:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
[INFO] | \- org.latencyutils:LatencyUtils:jar:2.0.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-cache:jar:2.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-context-support:jar:5.1.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.1.4.RELEASE:compile
[INFO] | \- com.sun.mail:javax.mail:jar:1.6.2:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.1.4.RELEASE:compile
[INFO] | +- org.thymeleaf:thymeleaf-spring5:jar:3.0.11.RELEASE:compile
[INFO] | | \- org.thymeleaf:thymeleaf:jar:3.0.11.RELEASE:compile
[INFO] | | +- org.attoparser:attoparser:jar:2.0.5.RELEASE:compile
[INFO] | | \- org.unbescape:unbescape:jar:1.1.6.RELEASE:compile
[INFO] | \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.4.RELEASE:compile
[INFO] \- org.springframework.boot:spring-boot-starter-web-services:jar:2.1.4.RELEASE:compile
[INFO] +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.5.0:compile
[INFO] | +- javax.xml.soap:javax.xml.soap-api:jar:1.4.0:compile
[INFO] | +- org.jvnet.mimepull:mimepull:jar:1.9.11:compile
[INFO] | \- org.jvnet.staxex:stax-ex:jar:1.8:compile
[INFO] +- javax.xml.ws:jaxws-api:jar:2.3.1:compile
[INFO] +- org.springframework:spring-oxm:jar:5.1.6.RELEASE:compile
[INFO] \- org.springframework.ws:spring-ws-core:jar:3.0.7.RELEASE:compile
[INFO] \- org.springframework.ws:spring-xml:jar:3.0.7.RELEASE:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
As I see you are having conflicts in your spring data dependency version
One is 2.1.6 another is 2.1.4
Please remove 2.1.4 version and change 2.1.6 scope to default(compile)

Spring cloud sleuth + Spring Boot 1.4.0 transitive dependencies issue

I am using Spring Boot 1.4.0 and spring-cloud-sleuth, here is my pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>spring-boot-test</groupId>
<artifactId>spring-boot-test</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>com.igor.Application</start-class>
<spring-cloud-sleuth.version>1.0.4.RELEASE</spring-cloud-sleuth.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth</artifactId>
<version>${spring-cloud-sleuth.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
and here is my dependency tree:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-boot-test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # spring-boot-test ---
[INFO] spring-boot-test:spring-boot-test:jar:1.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.4.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.4.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.0.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.0.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.4:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.4:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.4:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.1:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.1:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.1:compile
[INFO] | +- org.springframework:spring-web:jar:4.2.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.2.6.RELEASE:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.2.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:4.2.6.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.2.6.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.2.6.RELEASE:compile
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.4.0.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-test:jar:1.4.0.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.0.RELEASE:test
[INFO] +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | +- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] +- org.assertj:assertj-core:jar:2.5.0:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | \- org.objenesis:objenesis:jar:2.1:test
[INFO] +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] +- org.skyscreamer:jsonassert:jar:1.3.0:test
[INFO] | \- org.json:json:jar:20140107:test
[INFO] +- org.springframework:spring-core:jar:4.3.2.RELEASE:compile
[INFO] \- org.springframework:spring-test:jar:4.2.6.RELEASE:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.126 s
[INFO] Finished at: 2017-07-07T20:25:23+03:00
[INFO] Final Memory: 21M/437M
[INFO] ------------------------------------------------------------------------
it looks like spring-boot-sleuth has overridden dependencies, cause Spring Boot 1.4 uses spring 4.3.2.RELEASE.
I don't need it, how to avoid this behavior??
You can exclude dependencies in Maven. However you should consider using a release train BOM so that best matching dependencies are picked for you

ElasticsearchIntegrationTest with Spring Boot

I am trying to use ElasticsearchIntegrationTest (http://www.elastic.co/guide/en/elasticsearch/reference/1.x/integration-tests.html) for my Integration tests in a Spring Boot application.
#ElasticsearchIntegrationTest.ClusterScope(scope =ElasticsearchIntegrationTest.Scope.SUITE)
public class MyElasticsearchIntegrationTests extends ElasticsearchIntegrationTest
When I run this test, I am getting following error:
java.lang.AssertionError: Version must be upgraded to [4.10.4] is still set to [4.10.3]
at org.elasticsearch.Version.<clinit>(Version.java:229)
at org.elasticsearch.test.ElasticsearchTestCase.<clinit>(ElasticsearchTestCase.java:87)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.carrotsearch.randomizedtesting.RandomizedRunner$1.run(RandomizedRunner.java:553)
My dependencies are defined like this in my pom.xml:
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.5.1</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
<version>4.10.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
</dependencies>
And when I run mvn dependecy:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # demo ---
[INFO] com.sebpc:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.elasticsearch:elasticsearch:test-jar:tests:1.5.1:test
[INFO] | +- org.apache.lucene:lucene-core:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-queries:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-memory:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-sandbox:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-suggest:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-misc:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-join:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-grouping:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-spatial:jar:4.10.4:compile
[INFO] | | \- com.spatial4j:spatial4j:jar:0.4.1:compile
[INFO] | +- org.antlr:antlr-runtime:jar:3.5:compile
[INFO] | +- org.ow2.asm:asm:jar:4.1:compile
[INFO] | \- org.ow2.asm:asm-commons:jar:4.1:compile
[INFO] +- org.apache.lucene:lucene-test-framework:jar:4.10.4:compile
[INFO] | +- org.apache.lucene:lucene-codecs:jar:4.10.4:compile
[INFO] | +- com.carrotsearch.randomizedtesting:junit4-ant:jar:2.1.6:compile
[INFO] | +- com.carrotsearch.randomizedtesting:randomizedtesting- runner:jar:2.1.6:compile
[INFO] | +- junit:junit:jar:4.12:compile
[INFO] | \- org.apache.ant:ant:jar:1.8.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-elasticsearch:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework.boot:spring-boot-starter:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.11:compile
[INFO] | | \- org.slf4j:log4j-over-slf4j:jar:1.7.11:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.14:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.21:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.21:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.21:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.21:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | \- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.5.1:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.1:compile
[INFO] | +- org.springframework:spring-web:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | \- org.springframework:spring-beans:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-expression:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.3.0.BUILD-SNAPSHOT:test
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | | \- org.objenesis:objenesis:jar:2.1:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.springframework:spring-core:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-test:jar:4.2.0.BUILD-SNAPSHOT:test
[INFO] +- org.springframework.data:spring-data-elasticsearch:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework:spring-context:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework:spring-tx:jar:4.2.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.10.0.RELEASE:compile
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | +- joda-time:joda-time:jar:2.7:compile
[INFO] | +- org.elasticsearch:elasticsearch:jar:1.4.4:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.5.1:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.11:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.11:compile
[INFO] \- com.google.guava:guava:jar:18.0:compile
It looks like all the lucene related libraries are 4.10.4, not 4.10.3, that's why I am a bit confused with this error message.
Any help would be appreciated !
Thanks
You should not define artefact dependency for elasticsearch unless you want to use specific version as it will be added automatically by spring data elasticsearch.
with latest spring data elasticsearch snapshot 1.3.0.BUILD-SNAPSHOT you will get elasticsearch 1.5.2 which is latest version anyway.
suggestion : remove elasticsearch dependency from your pom and use transient dependency coming from spring data elasticsearch.
if you still want to use particular version then exclude elasticsearch dependency from spring data elasticsearch.

Resources