相关疑难解决方法(0)

RestEasy - 无法找到MessageBodyReader?

我编写了一个简单的RestEasy客户端代理来执行iTunes搜索.它看起来像这样:

@Path("/")
public interface AppleAppStoreLookupClient {

    /**
     * Attempts to lookup an apple app store item by its ID
     * 
     * @param id
     *            The item ID
     * @return The app details
     */
    @GET
    @Path("/lookup")
    @Produces(value = { "text/javascript" })
    public AppleAppDetailsResponse lookupByID(@QueryParam("id") String id);
}
Run Code Online (Sandbox Code Playgroud)

我的JSON模型类也很简单.实际上,对于第一次调用我想要的只是"resultCount"值,只是为了确保连接正常工作.

@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class AppleAppDetailsResponse implements Serializable {

    private static final long serialVersionUID = 8881587082097337598L;

    @XmlElement
    private int resultCount = -1;

   ...getters and setters...

}
Run Code Online (Sandbox Code Playgroud)

但是,当我运行一个简单的测试时,我得到以下异常:

org.jboss.resteasy.client.ClientResponseFailure: Unable to find a MessageBodyReader of …
Run Code Online (Sandbox Code Playgroud)

java rest json exception resteasy

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

exception ×1

java ×1

json ×1

rest ×1

resteasy ×1