zoukankan      html  css  js  c++  java
  • org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported

    最后找到我的问题,springmvc配置文件中没加 <mvc:annotation-driven/>

    java代码:

    @RequestMapping(value="/requestJsonResposeJson",method=RequestMethod.POST,produces={"application/json;charset=UTF-8"})
      public @ResponseBody TestSupervisorCustomer  requestJsonResposeJson(@RequestBody TestJson testJson) throws Exception

    restclient测试的:

    错误信息:

    org.springframework.web.servlet.DispatcherServlet]DispatcherServlet with name 'springMvc' processing POST request for [/NongyeInfo/userContoller/requestJsonResposeJson.do]
    [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Matching patterns for request [/userContoller/requestJsonResposeJson.do] are [/userContoller/requestJsonResposeJson.*]
    [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]URI Template variables for request [/userContoller/requestJsonResposeJson.do] are {}
    [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapping [/userContoller/requestJsonResposeJson.do] to HandlerExecutionChain with handler [slc.controller.UserContoller@3c655b15] and 1 interceptor
    [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver]Resolving exception from handler [slc.controller.UserContoller@3c655b15]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
    [org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver]Resolving exception from handler [slc.controller.UserContoller@3c655b15]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
    [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver]Resolving exception from handler [slc.controller.UserContoller@3c655b15]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
    [org.springframework.web.servlet.DispatcherServlet]Null ModelAndView returned to DispatcherServlet with name 'springMvc': assuming HandlerAdapter completed request handling
    [org.springframework.web.servlet.DispatcherServlet]Successfully completed request
    [org.springframework.beans.factory.support.DefaultListableBeanFactory]Returning cached instance of singleton bean 'sqlSessionFactory'

  • 相关阅读:
    2019 SDN上机第5次作业
    hdu 2553 N皇后问题(递归)
    百练oj 2766 最大子矩阵和
    POJ 1664 放苹果
    POJ 3617 Best Cow Line(贪心)
    HDU 2013 ACM/ICPC Asia Regional Hangzhou Online ------ Zhuge Liang's Mines
    HDU 4712 Hamming Distance (随机算法)
    HDU 1171 Big Event in HDU
    HDU 1085 Holding Bin-Laden Captive!
    HDU 1028 母函数
  • 原文地址:https://www.cnblogs.com/mengjinluohua/p/5436511.html
Copyright © 2011-2022 走看看