测试接口是406错误
来源:6-9 用户模块所有功能自测试
qq_灰飛煙滅_0
2018-06-11
<!doctype html><html lang="en"><head><title>HTTP Status [406] – [Not Acceptable]</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status [406] – [Not Acceptable]</h1><hr class="line" ><p><b>Type</b> Status Report</p><p><b>Description</b> The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation.</p><hr class="line" ><h3>Apache Tomcat/9.0.0.M21</h3></body></html>
不知道是什么为报错
jar包也导入了
3回答
-
qq_灰飛煙滅_0
提问者
2018-06-11
找到原因了
applicationContext-datasource.xml 下面没有添加<mvc:annotation-driven/>
这句话
122018-11-29 -
johnnykuo2015
2019-05-15
太感谢这位同学了,我通过mockMvc进行测试,发现结果一直是406,解决思路一直是content,accept有问题,添加各种jar,修改servlet的配置(ContentNegotiationConfigurer),问题一直都无法修复,看到你这个方法,试了试,解决了我的问题,多谢
00 -
星辰Iron
2018-06-11
查看Jackson包是否存在,Spring MVC默认依赖Jackson包
012018-06-11
相似问题