在项目中调用一个第三方服务,第三方服务是用Spring Boot写成的.结果调用时返回"Could not find acceptable representation"错误. 经过调查和搜索,除了网上查到的其他方案之外,有可能是客户端Header参数Accept没有设置或者Accept设置的值在服务端不支持导致的,例如服务端自定义Accept值,而客户端没有传:或者传错了.…
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representatio     org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation at org.springframework.web.servlet.mvc.meth…
问题:在springmvc中添加Jackson jar包返回Object类型,处理器方法的produces属性不写,默认根据类型,但如果指定了(错误原因)produces = "text/html;charset=utf-8"就会报错 错误码: Handler execution resulted in exception: Could not find acceptable representation 正确配置: @RequestMapping(value = "/jac…
=================实体类转JSON报错的解决办法============= 之前在springmvc的时候也报过这个错,原因以及springmvc中解决办法参考:https://www.cnblogs.com/qlqwjy/p/8722802.html 今天在springboot中同样遇到这个错. 错误分析:后台返回的数据格式是json的时候,格式化实体类报错,如下: @RequestMapping("doLogin") @ResponseBody public JSO…
[原创文章]        使用Spring Boot的Web项目,处理/login请求的控制器方法(该方法会返回JSON格式的数据).此时如果访问localhost:8080/login.html,用户期望返回jsons数据,但框架却报错: There was an unexpected error (type=Not Acceptable, status=406). Could not find acceptable representation 或者这样的异常信息: org.springf…
异常信息 org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConv…
转自:https://blog.csdn.net/mate_ge/article/details/93518286?utm_source=distribute.pc_relevant.none-task 今天在实现响应输出流下载模板文件时,虽然功能正常,但是后台一直报错: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation 截图 在导出excel…
环境 Java 1.8 SpringBoot 2.1.9 Java 接口代码 @ResponseBody @RequestMapping(value = "cloud", method = RequestMethod.GET,produces = "applications/json;charset=UTF-8") public Boolean queryItemInfoAllInCloud(){ ItemInfo itemInfo = itemService.qu…
引起的原因:    由于设置了@ResponseBody,要把对象转换成json格式,缺少转换依赖的jar包,故此错. 解决办法: <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> </dependency> <dependency> <groupId>org.codeha…
使用SpsringMVC,使用restEasy调试,controller请求设置如下: @RequestMapping(value="/list",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_VALUE) @ResponseBody public List<EditTimeout> list(){ List<EditTimeout> list = editImpl.selectAll(…