【发布时间】:2016-10-26 19:06:03
【问题描述】:
我正在使用 jersey restful 应用程序。
在将对象列表从 JSON 转换为对象时出现以下错误。
球衣客户代码
def itemList= clientResponse.getEntity(new GenericType<List<Item>>(){});
堆栈跟踪
Error |
java.lang.NoSuchMethodException: java.util.List.<init>()
Error |
at java.lang.Class.getConstructor0(Class.java:3074)
Error |
at java.lang.Class.getDeclaredConstructor(Class.java:2170)
Error |
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredConstructor(ReflectiveInterceptor.java:456)
Error |
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassNewInstance(ReflectiveInterceptor.java:983)
Error |
at com.sun.jersey.core.provider.jaxb.AbstractListElementProvider.readFrom(AbstractListElementProvider.java:306)
Error |
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:634)
Error |
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:604)
Error |
at com.sun.jersey.api.client.ClientResponse$getEntity.call(Unknown Source)
虽然我在 itemList 中得到了正确的值。
谁能告诉我它为什么会出现以及避免它的解决方案是什么?
【问题讨论】:
标签: java jersey jersey-2.0 jersey-client