com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:1 字节 UTF-8 序列的字节 1 无效

com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence

提问人:Chaithra Shenoy 提问时间:3/24/2023 最后编辑:Chaithra Shenoy 更新时间:3/29/2023 访问量:121

问:

当我从UI触发终结点时,我收到错误。当我尝试从邮递员那里时,应用程序给出了成功响应。并且我无法访问从微服务应用程序中的 UI 生成的 XML。

错误

org.springframework.http.converter.HttpMessageNotReadableException: Could not unmarshal to [class com.core.navigation.schema.Navigation]: null; nested exception is javax.xml.bind.UnmarshalException
  with linked exception:
[com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.]

控制器代码

 @RequestMapping(value = "/values", method = RequestMethod.POST)
    @ApiOperation(value = "Method to get the data")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Bad Request"),
            @ApiResponse(code = 404, message = "Resource not available"),
            @ApiResponse(code = 415, message = "Unsupported Media Type"),
            @ApiResponse(code = 500, message = "Internal Server Error")})
    @ResponseBody
    Navigation overlays(@RequestBody @ApiParam(name = "navigation", value = "XML schema", required = true) Navigation navigation,
            @RequestHeader @ApiParam(name = "headers", value = "Http headers", required = true) Map<String, String> headers)
            throws JAXBException; 

POM.xml 依赖项与版本

spring-boot-starter-web - 2.0.8.RELEASE
gson                    - 2.3.1
json-lib                - 2.3
spring-cloud-starter-kubernetes-config -1.1.10.RELEASE
json                    - 20230227
xmlrpc-client           - 3.1.3
spring-security-oauth2-autoconfigure - 2.0.8.RELEASE
spring-security-config
spring-security-web
spring-cloud-starter-openfeign - 2.0.0.RELEASE
spring-cloud-starter-netflix-ribbon - 2.0.0.RELEASE
spring-boot-starter-actuator
commons-lang3           - 3.8.1
lombok
spring-cloud-starter-config - 2.0.3.RELEASE
micrometer-registry-prometheus - 1.2.2
micrometer-core - 1.2.2
spring-boot-starter-test
spring-cloud-dependencies - Finchley.SR3
xml spring-boot java-8 utf-8

评论


答: 暂无答案