Jmeter中java.net.URISyntaxException错误

今天在作服务发布性能测试的时候,傻傻的犯了个错,没有对参数进行仔细的检查,直接从fiddler中copy到jmeter中了,业务流程配置好后执行测试报错。。。java

jmeter中的响应结果以下:apache

java.net.URISyntaxException: Illegal character in query at index 222: http://xxx.xx.xx.24:9006/xx-cloud/rest/china1_10/wmts?service=WMTS&...&width=256&tileSize=256&fullExtent=[object Object]&tilematrix=10&tilerow=146&tilecol=820
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3111)
    at java.net.URI$Parser.parse(URI.java:3053)
    at java.net.URI.<init>(URI.java:588)
    at java.net.URL.toURI(URL.java:946)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
    at java.lang.Thread.run(Thread.java:745)

仔细检查了一下各控件的相关参数,感受没有什么问题,顿时萌币了。性能

好吧,休息一下,想想当初哪里的雷忘了排了,对照着原始Url仔细对比,发现响应报错中fullExtent的参数值为[object Object],在请求中没有进行转码,致使存在特殊符号“空格”,坑啊。。。测试

解决方法:编码

一、自动转码:spa

    在jmeter的“HTTP请求”中勾选fullExtent参数后面的“编码?”复选框,以下图所示:.net

  

二、手动转码:rest

  手动转码就简单了,将fullExtent的参数值手动转码为[object%20Object]后对其赋值便可。code

PS:任何事情都须要细致严谨,尤为作测试工做,2018年第一份随笔,但愿新的一年生活上家庭甜美,身体健康,工做上严谨细致,勇攀高峰!blog

相关文章
相关标签/搜索