Runtime exception with jersey - java.lang.AbstractMethodError

泪湿孤枕 提交于 2021-02-10 18:09:04

问题


I am trying to execute a RESTful web service deployed on tomcat using Jersey implementation.

Following is the resource class

@Path("/rest") public class PatientResource {

PatientService patientService;

@GET
@Path("/patient/{patientId}")
@Produces(MediaType.APPLICATION_JSON)
public Patient getPatientDetails(@PathParam("patientId") String patientId) {
    //return patientService.getPatientDetails(patientId);
    return new PatientService().getPatientDetails(patientId);
}

@GET
@Path("/patients")
@Produces(MediaType.APPLICATION_JSON)
public PatientData<Patient> getAllPatients() {
    //return patientService.getAllPatients();
    return new PatientService().getAllPatients();
}

}

I have made necessary entries in web.xml and all necessary jars are available in classpath, however when application is started on tomcat and I enter the URL in browser, I get following exception

[Servlet execution threw an exception] with root cause java.lang.AbstractMethodError at org.codehaus.jackson.map.AnnotationIntrospector$Pair.findSerializer(AnnotationIntrospector.java:1148) at org.codehaus.jackson.map.ser.BasicSerializerFactory.findSerializerFromAnnotation(BasicSerializerFactory.java:367) at org.codehaus.jackson.map.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:252) at org.codehaus.jackson.map.ser.StdSerializerProvider._createUntypedSerializer(StdSerializerProvider.java:782)

Any idea how to resolve it ?


回答1:


Probably an inconsistency in the versions of Jersey and Jackson you are using at runtime .

What are your libs versions ?



来源:https://stackoverflow.com/questions/14954738/runtime-exception-with-jersey-java-lang-abstractmethoderror

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