0
Guys I’m trying to perform a query in a time forecast API but whenever I will perform the query give me this exception
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: URI is not absolute] with root cause
My control where you are with Resttemplate is like this
RestTemplate restTemplate = new RestTemplate();
StringBuilder stringBuilder = new StringBuilder();
String urlFinal = stringBuilder.append(url).append(cidade).append("&appid=").append(apiKey).toString();
ResponseEntity<WeatherResponseObject> entity = restTemplate.getForEntity(urlFinal, WeatherResponseObject.class);
System.out.println(entity.getBody());
return entity.getBody();
And finally the return of my Weatherresponseobject
public List<BodyWeather> list;
as you are having an Illegalargumentexception exception does the following, take the impression of that urlFinal on your console and check if and endpoint is correct.
– André Martins
I have performed this test to check if the endpoint was wrong, however it is generated correctly, also I have passed the url directly to check if it was not this
– gabriel silva