JMeter 5.4.1 HTTP Request Sampler takes variable names as lower cases

132 views
Skip to first unread message

Asanke Galgomuwa

unread,
Feb 16, 2021, 1:27:39 AM2/16/21
to jmeter-plugins
I have variable extracted from a previous request and saved under "imageURL"

When I Use that variable within the HTTP Request ;

Protocol : ${__substring(${imageURL}, 0, 5)}

The Script fails with the following.

java.net.MalformedURLException: unknown protocol: ${__substring(${imageurl}, 0, 5)}
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:1118)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)
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)


This works well in JMeter 5.2.1

Thanks!

Felix Schumacher

unread,
Mar 11, 2021, 1:31:28 PM3/11/21
to jmeter-plugins
The exception converts the given protocol to the lowercase string, not JMeter.
You can try it yourself by opening jshell and typing in:

jshell> new URL("${__substring(${imageURL}, 0, 5)}", "DOMAIN", "/something")
|  Exception java.net.MalformedURLException: unknown protocol: ${__substring(${imageurl}, 0, 5)}
|        at URL.<init> (URL.java:452)
|        at URL.<init> (URL.java:338)
|        at URL.<init> (URL.java:361)
|        at (#6:1)

Most probably reason is, that the variable imageURL has not been extracted at that point. Try to add a Debug Sampler or look at the log messages, if some other exception has been logged before. Make sure, that the extraction of the url into the variable has really been successful.
Reply all
Reply to author
Forward
0 new messages