com.fasterxml.jackson.core.JsonParseException

时间:2017-05-18 16:54:58

标签: jackson rest-client

我使用Swagger代码生成器创建了一个OpenFeign Rest客户端。我在API接口中的客户端方法

**

@RequestLine("GET /documents/{id})
@Headers({
    "Content-type: application/json",
    "Accept: */*",
  })
File getDocument(@Param("id") String id);

**

它基本上返回文档。我尝试下载的文档是一个txt文件,其内容只有一个单词 testDocument

Exception in thread "main" feign.FeignException: Unrecognized token 'testDocument': was expecting 'null', 'true', 'false' or NaN
 at [Source: java.io.BufferedReader@1c1bbc4e; line: 1, column: 25] reading GET <MYSERVICE_URL>
    at feign.FeignException.errorReading(FeignException.java:49)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:140)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
    at com.sun.proxy.$Proxy7.getDocumentVersionContent(Unknown Source)
    at test.Main.main(Main.java:51)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'testDocument': was expecting 'null', 'true', 'false' or NaN
 at [Source: java.io.BufferedReader@1c1bbc4e; line: 1, column: 25]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1586)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:521)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2754)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2731)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._matchToken(ReaderBasedJsonParser.java:2538)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._matchTrue(ReaderBasedJsonParser.java:2489)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:676

注意:我已删除错误跟踪中的URL

0 个答案:

没有答案