Мой запрос работает как в PostMan, так и в IntelliJ. Я получаю ошибку «500» при запуске приложения из командной строки.
Ошибка:
Исключение в потоке "main" org.springframework.web.client.HttpServerErrorException $ InternalServerError: 500 Internal Server Error: [{"Message": "Ссылка на объект не установлена для экземпляра объекта." }] at org.springframework.web.client.HttpServerErrorException.create (HttpServerErrorException. java: 100)
at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:100)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:172)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:112)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:782)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:740)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:449)
с использованием следующего кода:
HttpEntity<String> requestEntity = new HttpEntity<>(httpHeaders);
ResponseEntity<SchedulerResponse> responseEntity = restTemplate.postForEntity(url.toString(), requestEntity, ClientResponse.class);
основной:
public static void main(String args[]) {
CommandLine commandLine = parseOptions(args);
final ApplicationContext applicationContext = loadApplicationContext(configurationFile);
}