Initial exception
org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class com.cdw.common.core.model.Resp] with preset Content-Type 'text/json;charset=UTF-8'
Solution:
Set ↓
resp.setContentType("text/json");
Change to ↓
resp.setContentType("application/json");
Then another exception occurs
java.lang.IllegalStateException: getOutputStream() has already been called for this response
Solution:
Set ↓
this.writeObjectToJson(resp, this.reportProviders);
Change to ↓
this.writeObjectToJson(resp, JSONObject.toJSON(this.reportProviders));
Full screenshot after modification:
Read More:
- [Solved] mybatisplus BaseMapper Error: required a single bean, but 2 were found
- The node requests the API address written by java to report an error error:getaddrinfo ENOTFOUND
- Springboot controls the startup of rabbitmq through configuration files
- Feign calls cannot use “_” to report errors [How to Solve]
- [Solved] Upload Files Error: Request processing failed;nested exception is org.springframework.web.multipart.MultipartExcepti
- IDEA springboot can recognize POM files, but suddenly it can’t reference mven dependencies. Strange things, inexplicable solutions
- How to Open Files by Dragging and Dropping in C#
- Springboot Files Upload Limit Error: The field file exceeds its maximum permitted size of 1048576 bytes
- How to Solve Springboot Upload Files Error: The field XXX exceeds its maximum permitted size of 1048576 bytes
- How to Solve RAR Files Extract Error with sevenzipjbinding (Multithread Processing)
- Mybatis reports an error (error building sqlsession.) when using annotations without deleting redundant files
- Error starting ApplicationContext. To display the conditions report re-run your application with ‘de
- Spring Boot Error starting ApplicationContext. To display the auto-configuration report re-run you
- How to Use filechannel to copy files
- SpringBoot—Error starting ApplicationContext. To display the auto-configuration report re-run your a
- [Solved] JAVA connect HBase program is stuck and does not report an error
- SpringCloud Use openFeign Multipartfile to Upload Files Error: Current request is not a multipart request
- JAVA: How to Use Multipartfile to upload Files
- How to Solve IntelliJ IDEA Error: Cannot determine path to ‘tools.jar‘ library for 17 (C:\Program Files\Java\jd…
- Java uses class array to report error Exception in thread “main” java.lang.NullPointerException solution