-1

I have an application for which I have recorded Jmeter scripts to conduct load testing. Authorization happens via Azure AD.

I have co-related the auth-related such as access tokens, refresh tokens and id tokens that are generated dynamically and also parameterized them in a request that is responsible for calling the API and which would probably require those tokens to authorize the call to the API.

However, I get an error:-

java.net.URISyntaxException: Illegal character in query at index 98:
    at java.base/java.net.URI$Parser.fail(URI.java:2938)
    at java.base/java.net.URI$Parser.checkChars(URI.java:3109)
    at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3197)
    at java.base/java.net.URI$Parser.parse(URI.java:3139)
    at java.base/java.net.URI.<init>(URI.java:623)
    at java.base/java.net.URL.toURI(URL.java:1063)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:615)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
    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.base/java.lang.Thread.run(Thread.java:832)

I am not sure where I am going wrong. I have co-related 3 dynamic tokens which are generated as part of the auth token request.

Screenshots in the below link:-

Regular Expression Extractor

Setting parameters

Error on Jmeter

2
  • I think you need to put Authorization in a HTTP header instead of a parameter. Commented Dec 16, 2020 at 2:33
  • 1
    I haven't counted, but index 98 does seem to be around the : between pages and listTiles, and : is a reserved character. You need to percent-encode the colon. Commented Dec 16, 2020 at 3:56

3 Answers 3

0

I believe these "tokens" should go into the HTTP Header Manager as placing them as request parameters adds them to the request URL.

If your application expects the tokens to be a part of the URL (which is kind of strange) then you either need to tick the URL Encode? boxes or wrap the values which can contain the characters requiring encoding into __urlencode() function

Sign up to request clarification or add additional context in comments.

Comments

0

I faced this issue. What I did wrong, was that I did not put the "$" sign before the parameters in the URL.

How I resolved the issue: When I got the exception, I counted the characters in the URL till the index (given in the exception) which made me realize that something is wrong with the given index, then I checked the tutorial which I was following, and Hoorah! the issue has been found.

Example Image

Comments

0

In jmeter there is a checkbox for _urlencode() function.Refer the image

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.