什么是与Jackson 2.9.2兼容的Jersey版本? [英] What are the Jersey versions compatible with Jackson 2.9.2
问题描述
请帮助我解决这两个查询/问题:
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 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.
To support the most recent version of Jackson, you could get rid of the jersey-media-json-jackson
extension module.
然后添加 ResourceConfig
或 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屋!