BeanDefinitionStoreException Failed to read candidate component class

后端 未结 8 590
醉梦人生
醉梦人生 2020-12-05 19:20

Can someone tell me how to solve this issue?

I have narrowed down the problem to the pom.xml file. My project works but when I add the following dependency I get an

相关标签:
8条回答
  • 2020-12-05 19:59

    I had a similar error due to a corrupted class file -- somehow the CI build had a zero bytes class file in the jar (despite a non-zero inner class file being present, others ok) - one broken file out of ~100 classes. It might have been a disk space issue, but took a while to realise (since the class was in a dependent project jar, built by Gradle into a fat-jar for a Spring Boot project).

    0 讨论(0)
  • 2020-12-05 20:00

    Another reason is use of Spring 3 with Java 8. Java 8 requires Spring 4.

    (not specific to this question, but for those who are googling the error message)

    0 讨论(0)
  • 2020-12-05 20:00

    I am using spring 3.2.3.RELEASE.When i changed the jdk.version 1.8 to 1.6 in maven compiler plug-in it started working

    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>${jdk.version}</source>
                <target>${jdk.version}</target>
            </configuration>
    </plugin>
    
    0 讨论(0)
  • 2020-12-05 20:08

    When I tried to change the sequence of jars in the build path with <classpathentry kind="lib" path="/CoreTrainSim-Software-COTS/spring_jars/spring-core-5.1.7.RELEASE.jar"/>

    it worked

    0 讨论(0)
  • 2020-12-05 20:08

    How to solve this problem?

    Solution1:Change spring version to >= 3.2.16.

    Solution2:If your spring versin is low than 3.2.16, dont use Annotation such as :@Service @Controller and so on. Use bean.xml define a bean, the bean.xml don't contians "<context:component-scan base-package=""/>". if you must use <context:component-scan base-package=""/> please put in other bean.xml.

    0 讨论(0)
  • 2020-12-05 20:12

    In my case I had dependencies that brought in the spring-asm dependency that conflicted with the latest Spring core. So in Dependency Hierarchy search for "asm" and exclude spring asm from all dependencies having it.

    My case: 1)

    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.fileupload</artifactId>
        <version>2.3.1</version>
            <exclusions>
                    <exclusion>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-asm</artifactId>
                   </exclusion>
            </exclusions>
    </dependency>
    

    2)

    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.spring</artifactId>
        <version>2.1.2</version>
             <exclusions>
                      <exclusion>
                             <groupId>org.springframework</groupId>
                             <artifactId>spring-asm</artifactId>
                      </exclusion>
             </exclusions>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题