什么是与Jackson 2.9.2兼容的Jersey版本? [英] What are the Jersey versions compatible with Jackson 2.9.2

查看:96
本文介绍了什么是与Jackson 2.9.2兼容的Jersey版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我解决这两个查询/问题:

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

使用Jackson 2.9.2的任何人都可以,让我知道什么是Jackson 2.9.2的兼容Jersey版本.我当前正在使用Jersey 2.23.2,但不适用于Jackson 2.9.2.我得到了出现以下错误:

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)总的来说,有什么方法可以找到Jars的组合.我在查找Jersey和Spring jars的正确组合时也遇到了这个问题.可以对此进行指导.

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.

谢谢.

推荐答案

截至2017年11月中旬,Jersey的最新版本为2.26.

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

Jersey通过 扩展模块,该模块以与Jersey核心模块相同的版本号发布.此扩展模块包含可自动发现的 注册

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.

在版本2.26中,此扩展取决于Jackson 2.8.4.在2.23.2版本中,它取决于Jackson 2.5.4.

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.

要支持最新版本的Jackson,您可以摆脱

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

然后添加 模块添加到您的项目中,并注册 Application 实现.

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

这篇关于什么是与Jackson 2.9.2兼容的Jersey版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆