Request processing failed; nested exception is org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [com.project.payments.PaymentResponseVO] and content type [application/json;charset=UTF-8]
이런 에러가 발생합니다.
에러가 발생한 부분은 이 부분이구요
private static final String HOST = “https://kapi.kakao.com”;
private PaymentResponseVO paymentResponseVO;
//결제 준비
public PaymentResponseVO paymentPrepare() throws Exception{
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "KakaoAK 17ed51ef6684320d006c4642ebf99c60");
headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
map.add("cid", "TC0ONETIME");
map.add("partner_order_id", "1001");
map.add("partner_user_id", "gorany");
map.add("item_name", "S9");
map.add("quantity", "1");
map.add("total_amount", "2100");
map.add("tax_free_amount", "100");
map.add("approval_url", "http://localhost/s12/member/paymentSuccess");
map.add("cancel_url", "http://localhost/s12/member/paymentCancel");
map.add("fail_url", "http://localhost/s12/member/paymentFail");
/*
* map.add("cid", paymemtsVO.getCid()); map.add("partner_order_id",
* paymemtsVO.getPartner_order_id()); map.add("partner_user_id",
* paymemtsVO.getPartner_user_id()); map.add("item_name",
* paymemtsVO.getItem_name()); map.add("quantity",
* Integer.toString(paymemtsVO.getQuantity())); map.add("total_amount",
* Integer.toString(paymemtsVO.getTotal_amount())); map.add("tax_free_amount",
* Integer.toString(paymemtsVO.getTax_free_amount())); map.add("approval_url",
* paymemtsVO.getApproval_url()); map.add("cancel_url",
* paymemtsVO.getCancel_url()); map.add("fail_url", paymemtsVO.getFail_url());
*/
HttpEntity<MultiValueMap<String, String>> body = new HttpEntity<MultiValueMap<String,String>>(map, headers);
paymentResponseVO = restTemplate.postForObject(new URI(HOST + "/v1/payment/ready"), body, PaymentResponseVO.class);
if(paymentResponseVO.getNext_redirect_pc_url() != null) {
System.out.println(paymentResponseVO.getNext_redirect_pc_url());
}else {
System.out.println("error");
}
return paymentResponseVO;
}