2

I have project which locally works fine but when I deploy war to server and try to execute Rest method, I get:

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)

I know that it is related with overlapping jars but could not find a solution. When I use JHades, I get messages related with Json or 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!

Pom.xml fragment related with Json or Jackson:

<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>2.22.</version>
</dependency>

I was trying to remove or replace jars but it does not work. How to solve this problem?

3

1 Answer 1

2

Added and worked like a charm:

<dependency>
  <groupId>com.owlike</groupId>
  <artifactId>genson</artifactId>
  <version>1.4</version>
</dependency>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.