zoukankan      html  css  js  c++  java
  • Jmeter中java.net.URISyntaxException错误

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

    jmeter中的响应结果如下:

    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],在请求中没有进行转码,导致存在特殊符号“空格”,坑啊。。。

    解决方法:

    1、自动转码:

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

      

    2、手动转码:

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

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

  • 相关阅读:
    python模块之cx_Oracle
    python模块之xml.etree.ElementTree
    CentOS7.4 安装 oracle12c
    Markdown语法整理
    ansible command模块将返回值写入变量
    pip安装模块时:error: command 'gcc' failed with exit status 1
    The hub and spoke model 轮辐模型/辐射模型
    ActiveMQ-Network of brokers集群模式
    ansible安装配置及最佳实践roles
    ansible报错Aborting, target uses selinux but python bindings (libselinux-python) aren't installed
  • 原文地址:https://www.cnblogs.com/Bug-Hunter/p/8182658.html
Copyright © 2011-2022 走看看