Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception

17,653

There are so many duplicate jars here ..

I would go here to generate a spring project with required dependencies.

Share:
17,653
Gene Xu
Author by

Gene Xu

Updated on June 16, 2022

Comments

  • Gene Xu
    Gene Xu almost 2 years

    I've been trying to solve this "destory method exception" with online tips but have no success. Here is the error message:

    2017-10-16 15:58:13.234 ERROR 12276 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception

    And here is my POM.xml dependencies:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-aws</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-aws-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
    </dependencies>
    

    From online it seems the problem is at the spring-boot-starter-data-jpa dependency. I tried older versions of the depenency, and clean mvn but none of them works.

    Update

    After regenerate pom from spring initializr, I still got the same error. Here is my pom.xml dependencies:

        <dependencies>
    <!--need this aws dependency for some packages-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-aws</artifactId>
            </dependency>
    <!--need this aws dependency for some packages-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-aws-jdbc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.16.6</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
        </dependencies>
    

    Any suggestions?

    • surya
      surya over 6 years
      do you have other dependencies? can you show your whole pom
    • surya
      surya over 6 years
      you have starter for multiple spring tools. I am assuming some version problems . Run the command 'mvn dependency:tree ' and then check and remove all unnecssary dependencies
    • Gene Xu
      Gene Xu over 6 years
      I ran mvn dependency: tree. The build passed with a success.
    • surya
      surya over 6 years
      What I meant is Check your output of mvn dependency tree and you will notice if there are multiple jars . If you use any ide such as eclipse, you can see in dependency hierarchy for Pom , and observe jars .
    • Gene Xu
      Gene Xu over 6 years
      There is only one 0.0.1-SNAPSHOT.jar got built.
    • johannesboyne
      johannesboyne over 6 years
      @halfer Did you resolve the issue in the end? I'm experiencing the same issue but only if I run my JAR inside a Docker container on a certain system. Locally, the same container, runs without any issues.
    • halfer
      halfer over 6 years
      @johannesboyne: I am the last editor of this question, not the author. The person you need to ping has their profile card on the right-hand side (@genexu). They last signed in December 18th, so may not respond to you quickly.
    • johannesboyne
      johannesboyne over 6 years
      Sometimes, people who edit actually find an answer later.