HTTP 400 UnsupportedMediaTypeException:RESTEASY001055:无法使用内容类型

时间:2019-06-26 15:56:14

标签: java json jax-rs postman soapui

如果JSON包含一个长度为8以上的字符({{1},ñíóú等),带有此错误日志的服务器响应

'

我尝试添加标头值11:16:54,869 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (http-127.0.0.1:8080-2) RESTEASY000100: Failed executing POST /path: org.jboss.resteasy.spi.ReaderException: org.codehaus.jackson.JsonParseException: Invalid UTF-8 middle byte 0x22 at [Source: org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl$InputStreamWrapper@1df9ca1; line: 37, column: 27] at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:201) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:137) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:160) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:561) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:543) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:128) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at XXX.filter.ApiOriginFilter.doFilterInternal(ApiOriginFilter.java:44) [classes:] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.5.9.Final-redhat-2-bz-1358913.jar:7.5.9.Final-redhat-3] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.5.9.Final-redhat-2-bz-1358913.jar:7.5.9.Final-redhat-3] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21] Caused by: org.codehaus.jackson.JsonParseException: Invalid UTF-8 middle byte 0x22 at [Source: org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl$InputStreamWrapper@1df9ca1; line: 37, column: 27] at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.impl.Utf8StreamParser._reportInvalidOther(Utf8StreamParser.java:2830) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.impl.Utf8StreamParser._reportInvalidOther(Utf8StreamParser.java:2837) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.impl.Utf8StreamParser._decodeUtf8_4(Utf8StreamParser.java:2682) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.impl.Utf8StreamParser._finishString2(Utf8StreamParser.java:1962) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.impl.Utf8StreamParser._finishString(Utf8StreamParser.java:1905) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.impl.Utf8StreamParser.getText(Utf8StreamParser.java:276) [jackson-core-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:26) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:13) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.SettableBeanProperty$FieldProperty.deserializeAndSet(SettableBeanProperty.java:579) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.SettableBeanProperty$FieldProperty.deserializeAndSet(SettableBeanProperty.java:579) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2704) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419) [jackson-jaxrs-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:106) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.read(GZIPDecodingInterceptor.java:63) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:109) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:168) [resteasy-jaxrs-2.3.13.Final-redhat-1.jar:] ... 31 more ,添加JVM参数Content-Type -> application/json;charset=utf-8,更改依赖项的版本,但无法解决问题。

当我使用邮递员时,我没有这个问题!我一直在从Postman复制时态的Header,并以SOAP复制它们,什么也没有。

我需要知道为什么会这样,因为在我的模块之间,我对-Dfile.encoding=UTF-8进行了请愿,并且遇到了同样的问题。

我对pom RESTEASY的依赖是:

/path

0 个答案:

没有答案