首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Amdatu + Jackson -不序列化ArrayList - RESTful服务和OSGi

Amdatu + Jackson -不序列化ArrayList - RESTful服务和OSGi
EN

Stack Overflow用户
提问于 2013-11-16 19:24:23
回答 1查看 389关注 0票数 0

我正在写一个Hello服务,并且被困在试图序列化/反序列化返回的类列表上。

我的代码应该返回Json中的Conferences列表:

代码语言:javascript
复制
@GET
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Description("lists conferences")
public List<Conference> list() {
    return agenda.listConferences();
}

现在,当我测试服务时,我会得到以下响应:

代码语言:javascript
复制
SEVERE: The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the java.util.ArrayList type and application/json mediaT
ype.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
Nov 16, 2013 2:49:00 PM org.apache.wink.server.internal.RequestProcessor logException
INFO: The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error) with message 'null' while
processing GET request sent to http://localhost:8080/conferences

如果我返回类Conference,它工作并返回类的各自Json,但是如果我让它返回一个会议列表,那么它会抛出这个异常。

我使用这些包来管理RESTful服务:

代码语言:javascript
复制
  <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-jaxrs</artifactId>
      <version>1.9.13</version>
  </dependency>
  <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <version>1.9.13</version>
  </dependency>
  <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <version>1.9.13</version>
  </dependency>
  <dependency>
      <groupId>org.amdatu.web</groupId>
      <artifactId>org.amdatu.web.rest.wink</artifactId>
      <version>1.0.1</version>
  </dependency>
  <dependency>
      <groupId>org.amdatu.web</groupId>
      <artifactId>org.amdatu.web.rest.jaxrs</artifactId>
      <version>1.0.0</version>
  </dependency>

有人知道为什么吗?

EN

回答 1

Stack Overflow用户

发布于 2013-11-24 21:47:31

原因是您使用的是一个旧版本的Amdatu。目前的版本是1.0.6。在您使用的版本中还没有杰克逊支持。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20022731

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档