Я пытаюсь вызвать службу отдыха от клиента. Мне удалось без каких-либо проблем вызвать некоторые из остальных служб в разных проектах.
Ошибка в строке restTemplate.postForEntity
private String postCarEvent(
Inspection inspection, Car car, String id, String carId) {
CarEventBean bean = carToCarEventBean(inspection, car, id, carId);
String eventId = null;
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<CarEventBean> request = new HttpEntity<>(bean, headers);
ResponseEntity<?> response = restTemplate.postForEntity(urlsConfig.getCarEventUrl(), request, CarEventBean.class);
System.out.println("postCar:car-event response :" + response);
if (Arrays.stream(Constants.SUCCESS_SERVICE_RESPONSES)
.anyMatch(status -> status == response.getStatusCode())) {
System.out.println("Car event inserted/updated successfully :)");
}
} catch (HttpClientErrorException e) {
System.out.println("In postCar:car-event - stats code :" + e.getStatusCode());
System.out.println(
"In postCar:car-event - response body as string :" + e.getResponseBodyAsString());
}
return eventId;
}
Ожидает вызова службы без ошибок
org.springframework.jms.listener.adapter.ListenerExecutionFailedException: Listener method 'public void com.lo.test.consumer.jms.InspectionReceiver.processInspection(com.lo.test.consumer.bean.Inspection)' threw exception; nested exception is org.springframework.web.client.HttpServerErrorException: 500 null
at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:112)
at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:69)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:721)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:681)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:651)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:317)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:255)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1166)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1158)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1055)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.web.client.HttpServerErrorException: 500 null
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:66)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407)
at com.lo.test.consumer.jms.InspectionReceiver.postCarEvent(InspectionReceiver.java:187)
at com.lo.test.consumer.jms.InspectionReceiver.lambda$2(InspectionReceiver.java:137)
at java.util.ArrayList.forEach(Unknown Source)
at com.lo.test.consumer.jms.InspectionReceiver.postCar(InspectionReceiver.java:134)
at com.lo.test.consumer.jms.InspectionReceiver.processInspection(InspectionReceiver.java:63)