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、神途免费辅助软件公共底牌简单...
七分钟了解!火神微信辅助!都是... 七分钟了解!火神微信辅助!都是是有辅助脚本(有挂细节)-哔哩哔哩1)火神微信辅助有没有挂:进一步探索...
7分钟了解!衢州都莱辅助器是真... 7分钟了解!衢州都莱辅助器是真是假!一贯存在有辅助方法(了解有挂)-哔哩哔哩进入游戏-大厅左侧-新手...
八分钟了解!玄龙辅助下载!竟然... 八分钟了解!玄龙辅助下载!竟然有辅助攻略(确实有挂)-哔哩哔哩运玄龙辅助下载辅助工具,进入游戏界面。...
十分钟了解!科乐天天踢起手好牌... 十分钟了解!科乐天天踢起手好牌!总是存在有辅助方法(确实有挂)-哔哩哔哩1、游戏颠覆性的策略玩法,独...
第一分钟了解!决战加血辅助!一... 第一分钟了解!决战加血辅助!一贯真的有辅助插件(有挂透视)-哔哩哔哩1、决战加血辅助透视辅助软件激活...
两分钟了解!欢聚水鱼科技辅助下... 两分钟了解!欢聚水鱼科技辅助下载!果然一直都是有辅助神器(有挂秘诀)-哔哩哔哩1、让任何用户在无需欢...
4分钟了解!微信小程序雀神挂件... 4分钟了解!微信小程序雀神挂件!真是真的有辅助插件(真的有挂)-哔哩哔哩1、完成微信小程序雀神挂件有...
两分钟了解!新上游通用挂是真的... 两分钟了解!新上游通用挂是真的吗!本来真的有辅助教程(有挂透视)-哔哩哔哩所有人都在同一条线上,像星...
四分钟了解!德州局脚本!一贯真... 四分钟了解!德州局脚本!一贯真的是有辅助神器(有挂细节)-哔哩哔哩1、上手简单,内置详细流程视频教学...