Jackson does not work in jersey

家住魔仙堡 提交于 2019-12-25 04:36:10

问题


Exception :-

Jun 29, 2015 10:32:20 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [idnsRulesServlet] in context with path [] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoSuchMethodError: org.codehaus.jackson.map.SerializationConfig.isEnabled(Lorg/codehaus/jackson/map/SerializationConfig$Feature;)Z
    at org.codehaus.jackson.jaxrs.JacksonJsonProvider.writeTo(JacksonJsonProvider.java:506)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1479)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)

i am using jersey 1.17 and jackson 1.9.0,jackson-mapper-asl-1.9.13 and apache tomcat8. kindly some one help me reslove this , thank you

my screen is shows to my jars.


回答1:


NoSuchMethodError often means a mixing of incompatible versions. Take out all the Jackson related jars/dependencies you have and use the below

With Maven

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-json</artifactId>
    <version>1.17</version>
</dependency>

Without Maven (Note: all the jars below are pulled in by jersey-json above. All might not be required for basic functionality, but I would include them anyway)

You may already have some, as they are Jersey jars. So just ignore those.

Here's a place You can search for all the jars



来源:https://stackoverflow.com/questions/31108268/jackson-does-not-work-in-jersey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!