我有本地工作正常的项目但是当我将war部署到服务器并尝试执行Rest方法时,我得到:
java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:474)
com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:393)
com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator.getDefaultMapper(JsonMapperConfigurator.java:44)
com.fasterxml.jackson.jaxrs.base.ProviderBase.locateMapper(ProviderBase.java:866)
我知道它与重叠的罐子有关但无法找到解决方案。当我使用JHades时,我收到与Json或Jackson相关的消息:
file:/C:/Users/justas/.m2/repository/com/google/http-client/google-http-client-jackson2/1.20.0/google-http-client-jackson2-1.20.0.jar overlaps with
file:/C:/Users/justas/.m2/repository/ppp/ppp/1.0/ppp-1.0.jar - total overlapping classes: 5 - same classloader ! This is an ERROR!
file:/C:/Users/justas/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.5.4/jackson-core-2.5.4.jar overlaps with
file:/C:/Users/justas/.m2/repository/ppp/ppp/1.0/ppp-1.0.jar - total overlapping classes: 79 - same classloader ! This is an ERROR!
与Json或Jackson相关的Pom.xml片段:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.22.</version>
</dependency>
我试图删除或替换罐子,但它不起作用。如何解决这个问题?
答案 0 :(得分:2)
添加并像魅力一样工作:
<dependency>
<groupId>com.owlike</groupId>
<artifactId>genson</artifactId>
<version>1.4</version>
</dependency>