简体   繁体   English

RestClientException无法提取响应:找不到合适的HttpMessageConverter作为响应类型

[英]RestClientException Could not extract response: no suitable HttpMessageConverter found for response type

I have following PoJo: 我有以下PoJo:

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KostenpflichtigeBuchung {
    private String buchungZahlungsId;

    private String warenkorbId;

    private String pseudocardpan;

    private Zahlungsmittel zahlungsmittel;

    private String landKreditkartenInhaber;

    private String nameKreditkartenInhaber;

    private String touchpointId;

    private String vertriebspartnerId;

    private Kundendaten kundendaten;

    private Fulfillmentart fulfillmentart;

    private final List<Reisender> reisenderList = new ArrayList<>();

    @JsonIgnore
    private Map<String, Object> payload;

    @JsonAnyGetter
    public Map<String, Object> getPayload() {
        return payload;
    }

    @JsonAnySetter
    public void setPayload(String name, Object value) {

        if (payload == null) {
            payload = new HashMap<>();
        }
        payload.put(name, value);
    }
}

When I execute a cucumber Test on it, I get the following Exception: 当我对其执行黄瓜测试时,出现以下异常:

org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class de.db.vendo.bue.buchung.model.KostenpflichtigeBuchung] and content type [application/json;charset=utf-8]

    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:109)
    at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:917)
    at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:901)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:655)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:531)

I have some other test and other POJO with the same annotation which are working without any problems. 我有一些其他的测试和具有相同批注的其他POJO,它们可以正常工作。 I have really not a single idea what is going wrong. 我真的不知道哪里出了问题。

Thank for any suggestion! 感谢您的任何建议!

Most probably issue between lombok constructor annotations and related generated constructors, often when I face this error, I just revert response class to @NoArgConstructor only and try again. 最有可能在lombok构造函数批注和相关的生成的构造函数之间出现问题,通常当我遇到此错误时,我仅将响应类还原为@NoArgConstructor,然后重试。

If you really need all these constructors and builders, try to code them manually and go with @JsonCreator like describe in this thread . 如果确实需要所有这些构造函数和构建器,请尝试手动对其进行编码,并使用@JsonCreator,如该线程中的 describe。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android版Spring-无法提取响应:找不到适合响应类型的HttpMessageConverter - Spring for Android - Could not extract response: no suitable HttpMessageConverter found for response type 无法提取响应:找不到合适的HttpMessageConverter - Could not extract response: no suitable HttpMessageConverter found 无法提取响应:没有找到适合响应类型 class 和内容类型 [text/html] 的 HttpMessageConverter - Could not extract response: no suitable HttpMessageConverter found for response type class and content type [text/html] 没有找到适合响应类型的 HttpMessageConverter - no suitable HttpMessageConverter found for response type RestClientException:无法写入请求:找不到适合请求类型的HttpMessageConverter - RestClientException: Could not write request: no suitable HttpMessageConverter found for request type Spring Rest客户端实现:无法提取响应:没有为xstreamMarshaller找到适合的响应类型的HttpMessageConverter - Spring Rest Client implementation : Could not extract response: no suitable HttpMessageConverter found for response type with xstreamMarshaller 休息模板:无法提取响应:当我们得到 xml 响应时,没有找到适合响应类型的 HttpMessageConverter,未绑定到 JAVA 对象 - Rest Template:Could not extract response: no suitable HttpMessageConverter found for response type when we got xml response, not bind to JAVA object HttpMessageConverter 异常:RestClientException:无法写入请求:找不到合适的 HttpMessageConverter - HttpMessageConverter exception : RestClientException: Could not write request: no suitable HttpMessageConverter found 找不到适合响应类型和内容类型的HttpMessageConverter - no suitable HttpMessageConverter found for response type and content type 没有为响应类型找到合适的HttpMessageConverter - Custom RestTemplate - No suitable HttpMessageConverter found for response type - Custom RestTemplate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM