NoClassDefFoundError

这种错误是由于在类加载的过程中出现的错误,区别于类编译报错的ClassNotFoundException

常见的原因是因为版本之间的冲突,常见于springboot的maven项目中,引入新的jar时,与默认配置的发生冲突

NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.ObjectMapper

<!-- 解决构建失败问题 -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.9.8</version>
            <!-- 版本可以使用2.9.3、2.9.5 、2.9.8,不能忽略version属性-->
        </dependency>

 

posted @ 2020-08-24 13:51  cambra  阅读(225)  评论(0编辑  收藏  举报