JMeter调用webservice接口报错:java.net.MalformedURLException: Illegal character found in host: ‘/‘

时间:2024-03-31 16:31:29

今天使用Jmeter5.3,调用webservice接口时,一直报错:

Content-Type text/xml
X-Gaia-Api-Key 30adfd-a23-2e026

JMeter调用webservice接口报错:java.net.MalformedURLException: Illegal character found in host: ‘/‘

执行后报错如下:

java.net.MalformedURLException: Illegal character found in host: '/'
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.getUrl(HTTPSamplerBase.java:1103)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1281)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1270)
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:630)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
    at java.lang.Thread.run(Unknown Source)

 

问题原因:

host包含特殊符号导致,需要进行处理。

将Server Name和path分开写即可。server name中包含Path路径后,不识别导致。

JMeter调用webservice接口报错:java.net.MalformedURLException: Illegal character found in host: ‘/‘