1

ジャージー実装を使用して、TomcatにデプロイされたRESTfulWebサービスを実行しようとしています。

以下はリソースクラスです

@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();
}

}

web.xmlに必要なエントリを作成し、必要なすべてのjarをクラスパスで使用できますが、tomcatでアプリケーションを起動し、ブラウザにURLを入力すると、次の例外が発生します。

[サーブレットの実行により例外がスローされました]ルート原因java.lang.AbstractMethodErroratorg.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)

それを解決する方法はありますか?

4

1 に答える 1

2

実行時に使用しているJerseyとJacksonのバージョンに矛盾がある可能性があります。

あなたのlibsバージョンは何ですか?

于 2013-02-22T15:41:07.137 に答える