0

I have following 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. I have really not a single idea what is going wrong.

Thank for any suggestion!

1
  • Have you checked this link already?
    – mcelikel
    Sep 25, 2017 at 15:00

1 Answer 1

0

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.

If you really need all these constructors and builders, try to code them manually and go with @JsonCreator like describe in this thread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.