Requirement is to consume a webservice and persist in database.
I wrote a stand alone class with Resttemplate and it works.
I used same url and same authentication mechanism + spring boot, war deployed on tomcat then when I hit the endpoint(which calls the webservice to get json output) it throws exception.
There was an unexpected error (type=Bad Request, status=400).
JSON parse error: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.PushbackInputStream@4be06322; line: 1, column: 2]
Can someone please assist.
Thanks.
I've had this error many times, and it turns out that I return HTML instead of JSON (hence the < character error).
To fix it, you need to check if the response is JSON or HTML to avoid parsing errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With