NoClassDefFoundError

NoClassDefFoundError

Method threw ‘java.lang.NoClassDefFoundError’ exception.

https://www.cnblogs.com/grey-wolf/p/10064164.html
编译不报错,运行时加载该类出错.比如static块执行失败了,等等.

https://blog.csdn.net/lsblsb/article/details/40623597

https://blog.csdn.net/T2080305/article/details/82144543

<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-mapper-asl</artifactId>
    <version>1.9.2</version>
</dependency>

Exception:
org.codehaus.jackson.map.ObjectMapper.setSerializationInclusion(Lorg/codehaus/jackson/map/annotate/JsonSerialize$Inclusion;)Lorg/codehaus/jackson/map/ObjectMapper;

https://ask.csdn.net/questions/269368
这种异常一般是jar包之间的版本不兼容,比如jar包A引用了某个版本的jar包B里面的方法,而你却使用的是jarB的另外一个版本.
这个版本没有对应的方法。

新用jackson 的最新版,看完整的异常栈,找到引用方,引用方的jar包也更新最新版

NoSuchMethodError

NoSuchMethodError
org.codehaus.jackson.map.ObjectMapper.setSerializationInclusion(Lorg/codehaus/jackson/map/annotate/JsonSerialize$Inclusion;)Lorg/codehaus/jackson/map/ObjectMapper;
调用 ObjectMapper.setSerializationInclusion() 1.8没有该方法,1.9.2有该方法.

setSerializationInclusion

上一篇:记一次Content type 'application/json;charset=UTF-8' not supported解决方案


下一篇:Jackson工具类