我的项目使用 Spring MVC 作为前端,使用 EJB 作为后端。当我使用 Jackson 在控制器级别中序列化和反序列化 json 字符串时,下面的代码工作正常,但服务层出现错误“未找到 com.fasterxml.jackson.core.JsonParseException 的类文件"
ObjectMapper mapper = new ObjectMapper();
Object convertedObject = mapper.readValue(jsonString, class);
我的模块 pom 文件包含依赖项。
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.3.0</version>
</dependency>
这个错误伴随而来mapper
创建对象后。
Error: Error:(247, 67) java: cannot access com.fasterxml.jackson.core.JsonParseException
class file for com.fasterxml.jackson.core.JsonParseException not found
您还需要包括
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.2</version>
</dependency>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)