jihedMaster
jihedMaster

Reputation: 331

Jersey 2.9 and Jackson provider

I'm using Jersey 2.9 along with Jackson, here you can find the dependencies:

 <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-client</artifactId>
  </dependency>

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

I have some POJO classes like Student.class which contains some properties, when I'm executing this client code:

Student studentRequest = new Student(); 

Response response = target()
                .path("/students/register")
                .request(MediaType.APPLICATION_JSON_TYPE)
                .post(Entity.json(studentRequest), Response.class);

The code does not work and I got this exception:

javax.ws.rs.ProcessingException: com.fasterxml.jackson.jaxrs.base.ProviderBase._configForWriting(Lcom/fasterxml/jackson/databind/ObjectWriter;[Ljava/lang/annotation/Annotation;)Lcom/fasterxml/jackson/jaxrs/cfg/EndpointConfigBase;
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:233)
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:655)
    ...
    at 
Caused by: java.lang.AbstractMethodError: com.fasterxml.jackson.jaxrs.base.ProviderBase._configForWriting(Lcom/fasterxml/jackson/databind/ObjectWriter;[Ljava/lang/annotation/Annotation;)Lcom/fasterxml/jackson/jaxrs/cfg/EndpointConfigBase;
    at com.fasterxml.jackson.jaxrs.base.ProviderBase._configForWriting(ProviderBase.java:469)
...

Anyone got an idea why I get this stacktrace ?

Thank you !

Upvotes: 1

Views: 2150

Answers (1)

Oleksii Kyslytsyn
Oleksii Kyslytsyn

Reputation: 2426

Encountering the same issue, in my case it helped to fix the java.lang.AbstractMethodError by adding the implementations as dependencies by maven dependency management system to client side in pom.xml:

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.2.2</version>
    </dependency>

Upvotes: 1

Related Questions