Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the Jersey versions compatible with Jackson 2.9.2

Could you please help me with these 2 queries/Issues :

Can anyone who has worked on Jackson 2.9.2 ,let me know what is the compatible Jersey version for Jackson 2.9.2.I am currently using Jersey 2.23.2 but it does not work with Jackson 2.9.2.I get following error :

[ERROR   ] SRVE0777E: Exception thrown by application class 'org.glassfish.jersey.servlet.WebComponent.serviceImpl:489'
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.util.BeanUtil.okNameForSetter(Lcom/fasterxml/jackson/databind/introspect/AnnotatedMethod;)Ljava/lang/String;
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)

2) In general ,is there some way to find combination of Jars.I have faced this issue earlier also while finding right combination of Jersey and Spring jars.It will save my and other's facing same issue lot of time,if someone can guide on this.

Thanks.

like image 570
javaguy Avatar asked Nov 12 '17 20:11

javaguy


1 Answers

As of mid November 2017, the most recent version of Jersey is 2.26.

Jersey supports Jackson via the jersey-media-json-jackson extension module, which is released under the same version number as Jersey core modules. This extension module contains the auto-discoverable JacksonFeature that registers the JacksonJsonProvider class for binding JSON to Java objects.

In the version 2.26, this extension depends on Jackson 2.8.4. While in the version 2.23.2, it depends on Jackson 2.5.4.

The BeanUtil.okNameForSetter(Annotated Method) method was deprecated in Jackson 2.5 and has been removed in Jackson 2.9.


To support the most recent version of Jackson, you could get rid of the jersey-media-json-jackson extension module.

Then add the jackson-jaxrs-json-provider module to your project and register the JacksonJsonProvider directly in your ResourceConfig or Application implementation.

like image 106
cassiomolin Avatar answered Oct 01 '22 05:10

cassiomolin