Upgraded spring boot from 2.1.9 to 2.2.0 , now getting exception while starting

29,520

Solution 1

In short, issue is due to spring cloud and spring boot version incompatibility, spring boot 2.2.X requires Hoxton release train instead of Greenwich. See below for more info.

This issue is due to spring-cloud.version incompatibility. As per spring cloud documentation link(https://spring.io/projects/spring-cloud), below is the spring boot compatibility:

Release train Spring Boot compatibility

Release Train      Boot Version

  Hoxton             2.2.x

  Greenwich          2.1.x

So if you are updating spring boot to 2.2.x then update to Hoxton release train for spring cloud as well i.e Hoxton.RC1(https://spring.io/blog/2019/10/25/spring-cloud-hoxton-rc1-released)

P.S: As per spring cloud Milestone page Hoxton.RELEASE in due on Nov 18, 2019 (https://github.com/spring-cloud/spring-cloud-release/milestones)

Solution 2

Actually springfox ist not compatible with Spring-Boot 2.2.0. It seems that springfox is dead at all.

Instead you can use: SpringDoc OpenApi

Solution 3

This seems to be a known issue: https://github.com/spring-cloud/spring-cloud-netflix/issues/3410

If you use Spring Cloud dependencies in your Spring Boot application make sure you have the correct Spring Cloud version on classpath! Only Spring Cloud's "Hoxton" (https://spring.io/blog/2019/08/19/spring-cloud-hoxton-m2-released) release train currently support Spring Boot 2.2.

Solution 4

Update your springfox-swagger version. I have upgraded springfox 2.9.2 running with boot 2.2.2

SpringFox needs version 1.2.0 version but Spring Boot 2.2.2 itself does not pull this in.So you somehow got spring-plugin-core-1.2.0.RELEASE in your classpath.Then it will work fine

Solution 5

As user10871691 and P3arl have already noted, the spring-plugin-core dependency is resolved with the wrong version 1.2.0.RELEASE. In order to force usage of the correct 2.0.0.RELEASE, you have to

  • EITHER exclude the wrong transitive dependency and specify the correct one,
  • OR pin (!) that dependency version in your pom.xml. This is done in the <dependenciesManagement> block, not in the <dependencies> block.

Example for Springfox 3.0.0 using version pinning in the <dependenciesManagement> block:

<spring-plugin-core.version>2.0.0.RELEASE</spring-plugin-core.version>
<springfox.version>3.0.0</springfox.version>
...

<dependencyManagement>
  <dependencies>
    <!-- Fix wrong resolved `spring-plugin-core` dependency version for springfox -->
    <dependency>
      <groupId>org.springframework.plugin</groupId>
      <artifactId>spring-plugin-core</artifactId>
      <version>${spring-plugin-core.version}</version>
    </dependency>

    <!-- API Documentation -->
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-boot-starter</artifactId>
      <version>${springfox.version}</version>
    </dependency>
  </dependencies>
</dependencyManagement>

<dependencies>
  <!-- API Documentation -->
  <dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>
  </dependency>
</dependencies>
Share:
29,520
Joyson Rego
Author by

Joyson Rego

Updated on August 26, 2021

Comments

  • Joyson Rego
    Joyson Rego almost 3 years

    I upgraded spring boot from 2.1.9 to 2.2.0 now I am facing some exception while starting the application

    java : openjdk11 spring-boot: v2.2.0.RELEASE

    I tried by deleting the jar from this below location and did mvn clean install, still no luck.

    .m2/repository/org/springframework/boot/spring-boot-actuator/2.2.0.RELEASE/spring-boot-actuator-2.2.0.RELEASE.jar

    error :

    
    ***************************
    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.cloud.client.discovery.health.DiscoveryCompositeHealthIndicator.<init>(DiscoveryCompositeHealthIndicator.java:41)
    
    The following method did not exist:
    
        org.springframework.boot.actuate.health.CompositeHealthIndicator.<init>(Lorg/springframework/boot/actuate/health/HealthAggregator;)V
    
    The method's class, org.springframework.boot.actuate.health.CompositeHealthIndicator, is available from the following locations:
    
        jar:file:/C:/Users/regosa/.m2/repository/org/springframework/boot/spring-boot-actuator/2.2.0.RELEASE/spring-boot-actuator-2.2.0.RELEASE.jar!/org/springframework/boot/actuate/health/CompositeHealthIndicator.class
    
    It was loaded from the following location:
    
        file:/C:/Users/regosa/.m2/repository/org/springframework/boot/spring-boot-actuator/2.2.0.RELEASE/spring-boot-actuator-2.2.0.RELEASE.jar
    
    
    Action:
    
    Correct the classpath of your application so that it contains a single, compatible version of org.springframework.boot.actuate.health.CompositeHealthIndicator
    

    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>
        <groupId>com.xxxxx.business.workflow</groupId>
        <artifactId>xxxxx-component-workflow-starter</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>jar</packaging>
        <name>xxxxx-component-workflow-starter</name>
        <description>xxxxx-component-workflow-starter</description>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.2.0.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>11</java.version>
            <jaxb-runtime.version>2.4.0-b180830.0438</jaxb-runtime.version>
            <spring-cloud.version>Greenwich.M1</spring-cloud.version>
           <zeebe-version>0.20.1</zeebe-version>    
            <google-guava.version>27.0.1-jre</google-guava.version>
            <xxxxx.version>1.0</xxxxx.version>
            <swagger.version>2.9.2</swagger.version>
            <jjwt.version>0.9.1</jjwt.version>
            <json.version>20180813</json.version>
            <slf4j-api.version>1.7.25</slf4j-api.version>
            <mysql.version>8.0.11</mysql.version>
            <mongo-java-driver.version>3.10.1</mongo-java-driver.version>
            <commons-io.version>2.6</commons-io.version>
            <commons-lang.version>2.6</commons-lang.version>
            <commons-pool2.version>2.5.0</commons-pool2.version>
            <redis.version>3.1.0</redis.version>
            <velocity.version>1.7</velocity.version>
            <velocity-tools.version>2.0</velocity-tools.version>
            <logstash-logback-encoder.version>5.3</logstash-logback-encoder.version>
            <httpclient.version>4.5.6</httpclient.version>
            <jaxb-runtime.version>2.4.0-b180830.0438</jaxb-runtime.version>
            <env>local</env>
        </properties>   
    
        <dependencies>
            <!-- Start: Spring Libraries -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-redis</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-config</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-rest</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-mail</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.kafka</groupId>
                <artifactId>spring-kafka</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-sleuth</artifactId>
            </dependency>
            <!-- End: Spring Libraries -->
    
            <!-- Adding JAXB Runtime since it is not shipped with JDK 9+ -->
            <dependency>
                <groupId>org.glassfish.jaxb</groupId>
                <artifactId>jaxb-runtime</artifactId>
                <version>${jaxb-runtime.version}</version>
            </dependency>
    
            <!-- Start: xxxxx Libraries -->
            <dependency>
                <groupId>com.xxxxx</groupId>
                <artifactId>xxxxx-entity</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>
            <dependency>
                <groupId>com.xxxxx</groupId>
                <artifactId>xxxxx-redis</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>
            <dependency>
                <groupId>com.xxxxx</groupId>
                <artifactId>xxxxx-mongo</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>           
            <dependency>
                <groupId>com.xxxxx</groupId>
                <artifactId>xxxxx-util</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>
            <dependency>
                <groupId>com.xxxxx.model</groupId>
                <artifactId>xxxxx-model</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>
            <dependency>
                <groupId>com.xxxxx.service</groupId>
                <artifactId>xxxxx-common-service</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>
            <dependency>
                <groupId>com.xxxxx.service</groupId>
                <artifactId>xxxxx-common-messaging</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>   
            <dependency>
                <groupId>com.xxxxx.service</groupId>
                <artifactId>xxxxx-common-security</artifactId>
                <version>${xxxxx.version}</version>
            </dependency>           
            <!-- End: xxxxx Libraries -->
    
            <!--  Adding Zeebe client as part of the Spring Startup -->     
            <dependency>
                <groupId>io.zeebe</groupId>
                <artifactId>zeebe-client-java</artifactId>
                <version>${zeebe-version}</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${google-guava.version}</version>
            </dependency>
    
            <!-- Logstash Log Encoder -->
            <dependency> 
                <groupId>net.logstash.logback</groupId> 
                <artifactId>logstash-logback-encoder</artifactId> 
                <version>${logstash-logback-encoder.version}</version> 
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql.version}</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.mongodb/mongo-java-driver -->
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>mongo-java-driver</artifactId>
                <version>${mongo-java-driver.version}</version>
            </dependency>       
    
            <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>${commons-lang.version}</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-pool2</artifactId>
                <version>${commons-pool2.version}</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
            <dependency>
                <groupId>redis.clients</groupId>
                <artifactId>jedis</artifactId>
                <version>${redis.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${httpclient.version}</version>
            </dependency>
    
            <!-- Start: Swagger Libraries -->
            <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <!-- End: Swagger Libraries -->
    
            <!-- Start: Spring Boot and Security Test Libraries -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
            <!-- End: Spring Boot and Security Test Libraries -->
    
        </dependencies>
    
        <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>
    
        <build>
            <finalName>xxxxx-component-workflow-starter</finalName>
            <filters>
                <filter>${env}-build.properties</filter>
            </filters>
            <resources>
                <resource>
                    <filtering>true</filtering>
                    <directory>${project.basedir}/src/main/resources</directory>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <release>${java.version}</release>
                    </configuration>
                </plugin>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-jar-plugin</artifactId>
                  <configuration>
                    <archive>
                      <manifestEntries>
                        <Automatic-Module-Name>com.xxxxx.business.workflow.component.starter</Automatic-Module-Name>
                      </manifestEntries>
                    </archive>
                  </configuration>
                </plugin>
            </plugins>
        </build>
    
        <repositories>
            <repository>
                <id>spring-milestones</id>
                <name>Spring Milestones</name>
                <url>https://repo.spring.io/milestone</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
        </repositories> 
    </project>
    
    

    New exception :

    ***************************
    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.data.rest.core.support.UnwrappingRepositoryInvokerFactory.<init>(UnwrappingRepositoryInvokerFactory.java:57)
    
    The following method did not exist:
    
        org.springframework.plugin.core.PluginRegistry.of(Ljava/util/List;)Lorg/springframework/plugin/core/PluginRegistry;
    
    The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:
    
        jar:file:/C:/Users/regosa/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class
    
    It was loaded from the following location:
    
        file:/C:/Users/regosa/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar
    
    
    Action:
    
    Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry
    
    ***************************
    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:
    
        springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)
    
    The following method did not exist:
    
        org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;
    
    The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:
    
        jar:file:/C:/Users/regosa/.m2/repository/org/springframework/plugin/spring-plugin-core/2.0.0.RELEASE/spring-plugin-core-2.0.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class
    
    It was loaded from the following location:
    
        file:/C:/Users/regosa/.m2/repository/org/springframework/plugin/spring-plugin-core/2.0.0.RELEASE/spring-plugin-core-2.0.0.RELEASE.jar
    
    
    Action:
    
    Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry
    

    How to resolve this issue?

  • Joyson Rego
    Joyson Rego over 4 years
    thanks, now i am geting another exception. i updated above in question
  • Joyson Rego
    Joyson Rego over 4 years
    it was a mistake. Do i need to update any library?
  • Briksins
    Briksins over 4 years
    Confirming Greenwich.SR3 doesn't work with Spring Boot 2.2.0 you need to add maven { url 'https://repo.spring.io/milestone' } and replace Greenwich on Hoxton.RC1
  • Joyson Rego
    Joyson Rego over 4 years
    is there any other libraries available. instead of swagger?
  • Tristate
    Tristate over 4 years
    @JoysonRego Spring REST Docs is awesome but follows another approach.
  • Nitin
    Nitin over 4 years
  • Tristate
    Tristate over 4 years
    @JoysonRego yes, here it is: stackoverflow.com/questions/58953513/…
  • chepaiytrath
    chepaiytrath over 4 years
    This worked for me. I was using Greenwich.RELEASE with Spring Boot 2.2.4 which started giving issues with when i started using the spring-boot-starter-actuator. Same error logs as mentioned in the question. Updated to Hoxton.SR1 and it started successfully.