蘇家郁
蘇家郁

Reputation: 61

Jmeter Illegal character found in host: '/' ISSUE

I tried to install Jmeter on my colleague computer when I executed http request.He has been showing this error, but I found that there is no such error in my computer. I wonder if anyone has encountered a similar problem?

My

My1 My2


Colleague

colleague1 colleague2

-- error message

java.net.MalformedURLException: Illegal character found in host: '/'
at java.base/java.net.URL.<init>(URL.java:480)
at java.base/java.net.URL.<init>(URL.java:360)
at java.base/java.net.URL.<init>(URL.java:383)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.getUrl(HTTPSamplerBase.java:1053)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1231)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1220)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253)
at java.base/java.lang.Thread.run(Thread.java:830)

Upvotes: 6

Views: 18570

Answers (4)

Ajay Kopperla
Ajay Kopperla

Reputation: 459

I faced this issue and it was for simple reason. in the server name/ip address instead giving only the severname/ip address i.e server1 i had accidentally included the https://server1 and spend two hours to resolve it

Upvotes: 1

Bilal Demir
Bilal Demir

Reputation: 686

This problem occurs when using the http request sampler, putting '/' at the end of the Server Name or Ip textbox. It will work if you delete the '/' character at the end of the host information and add it to path.

 this request sampler that works correctly

Upvotes: 5

Dmitri T
Dmitri T

Reputation: 168072

  1. This www.amazon.com/ref=nav_logo is not a valid hostname

    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, and the hyphen (-). A hostname may not start with a hyphen.

  2. In any case your URL query string is not correct, it should look like:

    https://www.amazon.com/?ref=nav_logo
                           ^mind this character
    

So correct HTTP Request sampler configuration would be:

enter image description here

Resulting into the following request observable via View Results Tree listener

enter image description here


Going forward be aware that you can build a JMeter Test Plan using HTTP(S) Test Script Recorder or JMeter Chrome Extension

Upvotes: 1

monhelm
monhelm

Reputation: 169

Even though I cannot tell you why the test behaves differently on your machine vs that of your colleaugue (I would guess that you probably chose different client implementations in the advanced section of the HTTP Request Sampler), you should definitely consider what part of your URL is:

  • Protocol
  • Server Name or IP
  • Path
  • Parameter

and use the corresponding fields in JMeter accordingly.

Hint: "/ref=nav_logo" is most definitely NOT part of the Server Name.

Upvotes: 0

Related Questions