JMeter 常见问题
1、jmeter 的 “消息体数据” 无法点击:
解决:parameters跟body data的方式两者只可选择其一,当一种方式下有数据时就无法使用另外一种,必须清空。
![](https://img.haomeiwen.com/i12359666/7b56b7fe92807879.png)
2、运行失败,响应体提示报500 :
报错: {"status":500,"message":"Content type 'text/plain;charset=UTF-8' not supported"} 等类似情况,如下图
![](https://img.haomeiwen.com/i12359666/d3bbccb3718ef5f7.png)
解决:网上找了很多解决方法都不管用,其实解决起来很简单,添加请求信息头(content-type,application/json),如下图
PS: content-type根据需要的情况选择,不区分大小写;
![](https://img.haomeiwen.com/i12359666/d708099ac1489d0d.png)
![](https://img.haomeiwen.com/i12359666/783610c9312b48f2.png)
3、参数 和消息体是两种形式,只能选择其中一种,使用后者能200,前者会报500
报错:{"status":500,"message":"JSON parse error: Unrecognized token 'username': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'username': was expecting ('true', 'false' or 'null')\n at [Source: (PushbackInputStream); line: 1, column: 10]"}
解决:
1)原因解析:参数,用于get 或put请求;消息体用于post 请求;
2)解决:把post请求的消息体参数放在 消息体里,见上一个常见问题的截图;
![](https://img.haomeiwen.com/i12359666/6c1559b581bbd85c.png)
若有其他问题,参考 http://www.cnblogs.com/hiln/p/9463134.html