POSTMAN调试报错:“Content type ‘text/plain;charset=UTF-8‘ not supported”
创始人
2024-09-25 02:23:13
0

问题描述:

        在使用POSTMAN进行接口调试时候,JavaIDE报错:Content type 'text/plain;charset=UTF-8' not supported。具体如下:

org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain;charset=UTF-8' not supported 	at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:225) 	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:158) 	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:131) 	at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121) 	at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:167) 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134) 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) 	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at com.github.xiaoymin.knife4j.spring.filter.ProductionSecurityFilter.doFilter(ProductionSecurityFilter.java:53) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at com.github.xiaoymin.knife4j.spring.filter.SecurityBasicAuthFilter.doFilter(SecurityBasicAuthFilter.java:90) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) 	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) 	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) 	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) 	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 	at java.lang.Thread.run(Thread.java:748) 2024-01-21 19:15:56.024 [http-nio-51801-exec-1] ERROR c.h.common.exception.ExceptionCatch - catch exception:Content type 'text/plain;charset=UTF-8' not supported

 造成原因:

        数据传输格式不一致,POSTMAN默认是Text格式,而我需要传入的是JSON格式,所以就报错了。

解决方案:

        弄清楚数据传输格式,在调试时候选择相应的格式即可。

参考博客:HttpMediaTypeNotSupportedException: Content type ‘text/plain;charset=UTF-8‘ not supported_content type 'text/plain;charset=utf-8' not suppor-CSDN博客

相关内容

热门资讯

重大来袭(大唐河北麻将)外挂透... 1、完成大唐河北麻将的残局,帮助玩家取得所有比赛的胜利,直登高塔的教程。2、多达1000个不同的游戏...
2024教程(双盈休闲)外挂透... 2024教程(双盈休闲)外挂透明挂辅助软件(有科技)周详教程(2024已更新)(哔哩哔哩)这是由厦门...
最新研发(途乐竞技)外挂透明挂... 一、最新研发(途乐竞技)外挂透明挂辅助挂(软件透明挂)透彻教程(2020已更新)(哔哩哔哩)AI软件...
一秒答解(乐逍遥跑胡子)外挂透... 1、这是跨平台的乐逍遥跑胡子黑科技,在线的操作超级的方便,而且功能也是很强大的。2、在线的操作方便,...
免费测试版(约局吧)外挂透明挂... 免费测试版(约局吧)外挂透明挂辅助攻略(透明挂软件)巨细无遗(2020已更新)(哔哩哔哩)准备好在约...
八分钟了解(闲来广东麻将)外挂... 八分钟了解(闲来广东麻将)外挂透明挂辅助攻略(辅助)深入教程(2023已更新)(哔哩哔哩);闲来广东...
玩家攻略推荐(闲趣龙岩麻将)外... 玩家攻略推荐(闲趣龙岩麻将)外挂透明挂辅助挂(软件透明挂)透彻教程(2023已更新)(哔哩哔哩),亲...
两分钟了解(九九山城麻将)外挂... 两分钟了解(九九山城麻将)外挂透明挂辅助插件(有辅助挂)详细教程(2024已更新)(哔哩哔哩)准备好...
普及知识(aa poker)外... 1、让任何用户在无需AI插件第三方神器的情况下就能够完成在aa poker下的调试。2、直接的在aa...
热点讨论(丽水都莱)外挂透明挂... 热点讨论(丽水都莱)外挂透明挂辅助插件(有挂的)条分缕析(2024已更新)(哔哩哔哩),亲,有的,a...