springcloud project web.client.HttpServerErrorException$InternalServerError: 500 Internal Server Error

created at 10-28-2021 views: 123

problem

In the springCloud project, the consumer module uses RestTemplate to call the provider module. When accessing a method in the consumer module, the following error occurs:

org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Internal Server Error
    at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:79) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:125) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:785) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:743) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]

solution

When I first saw the 500 error, I naturally thought it was a background service problem, but the log information in the consumer module felt relatively general, and it was difficult to locate the problem. After checking, it was found that an error occurred when the consumer used the restTemplate to call the provider service, so I checked the log of the provider module and found more detailed error information:

java.lang.IllegalArgumentException: Parameter value [2021-10-25] did not match expected type [java.util.Date (n/a)]

Then the problem will be solved

created at:10-28-2021
edited at: 10-28-2021: