I am trying to load test a java servlet that fetches records from an archive database.
The servlet works as follows:
1-Reads in post variables from HTTP header
2-Uses variables to query database
3-Returns XML
I have setup a test which I want to fire off HTTP requests with post variables however the test is not working, getting errors with J Meter.
Screenshot 1 - Shows the structure of the test
Screenshot 2 - Shows the CSV file I am reading from
I have placed the CSV file in the same folder that my test plan is saved in!
Screenshot 3 - Shows the HTTP request
This is the error output:
Thread Name: Thread Group 1-1 Sample Start: 2012-11-20 10:35:27 GMT
Load time: 0 Latency: 0 Size in bytes: 1113 Headers size in bytes: 0
Body size in bytes: 1113 Sample Count: 1 Error Count: 1 Response code:
Non HTTP response code: java.net.URISyntaxException Response message:
Non HTTP response message: Expected closing bracket for IPv6 address
at index 13:
http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
Response headers:
HTTPSampleResult fields: ContentType: DataEncoding: null
POST Request
POST http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
POST data:
[no cookies]
Returned DATA
java.net.URISyntaxException: Expected closing bracket for IPv6 address at index 13: http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.failExpecting(Unknown Source)
at java.net.URI$Parser.parseServer(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:232)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1075)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1064)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:426)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255)
at java.lang.Thread.run(Unknown Source)
Please help!
Thanks
Remove http:// from Server Name / IP field of your HTTP Request Sampler (that's pointed in HTTP Request fields description).
Look onto your generated POST request above in description:
POST Request
POST http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
Configure your HTTP Request as the following instead:
Server Name: sophos1.testserver.co.uk
Path: /servlet/archive
Implementation: Java
The easy way is that you could leave the server name blank and set the path to
http://sophos1.testserver.co.uk/servlet/archive
Check if there are any spaces in ServerName or IP field.
This gave me this error :
Response message: Non HTTP response message: Illegal character in
authority at index 7:
When extra spaces were trimmed in the beginning, it worked well.
Related
I'm trying to connect on Kubernetes websocket API but I get this error message:
java.lang.IllegalStateException: Message failed with status code 400 Bad Request; Error info: ErrorInfo(Illegal 'sec-websocket-protocol' header: Invalid input 'EOI', expected sec-websocket-protocol (line 1, column 1),
^)
at akka.http.impl.engine.ws.WebSocketClientBlueprint$UpgradeStage$1$$anon$1.onPush(WebSocketClientBlueprint.scala:107)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:747)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:649)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:471)
at akka.stream.impl.fusing.GraphInterpreterShell.receive(ActorGraphInterpreter.scala:410)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:603)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:618)
at akka.actor.Actor.aroundReceive(Actor.scala:502)
at akka.actor.Actor.aroundReceive$(Actor.scala:500)
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:529)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke(ActorCell.scala:495)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
I must be missing some configuration, do you knwo where this comes from?
Cheers
Got over it by defining subprotocol to channel.k8s.io:
WebSocketRequest(
uri,
extraHeaders = List(token),
subprotocol = Option("channel.k8s.io")
)
When I am sending GET method request in jmeter its giving me an error
Response:
java.net.URISyntaxException: Illegal character in path at index 63: http://52.30.181.28:9000/PlatformServices/api/v2.0/kartCharges/{"pincode":560001,"gatewayPaymentMode":"NA","kartInfo":[{"sellerId":"S10014","qty":30,"unitPrice":1999,"sku":"SKU0100"}]}
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:3105)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:588)
at java.net.URL.toURI(URL.java:939)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:286)
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.process_sampler(JMeterThread.java:434)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
at java.lang.Thread.run(Thread.java:745)
Request:
GET http://52.30.181.28:9000/PlatformServices/api/v2.0/kartCharges/{"pincode":560001,"gatewayPaymentMode":"NA","kartInfo":[{"sellerId":"S10014","qty":30,"unitPrice":1999,"sku":"SKU0100"}]}
[no cookies]
Your request body is in json format.
So in HTTP Header Manager add content-type as application/json.
Then put below part in url:
http://52.30.181.28:9000/PlatformServices/api/v2.0/kartCharges/
And put rest in body part.
={"pincode":560001,"gatewayPaymentMode":"NA","kartInfo":[{"sellerId":"S10014","qty":30,"unitPrice":1999,"sku":"SKU0100"}]}
I'm testing an asp.net web aplication with jmeter.
I'm correlating the dynamic variables but I'm having problems getting the value of the variable "Guid".
First it cost me a lot to know where is comming, I realized that the first time is been requested by the GET method and by using an sniffer I found that is comming in the GET parameters (the querystring), the second time is comming by the GET too but is been sended by the url, like that:
"request": {
"method": "GET",
"url": "http://srvdr.ajk.fye:27080/Art/WebP/Wep.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1413&AK=12345&FechaInicio=03/02/2015%2004:01:56%20p.m.&mnu=999&Guid=64a42d6e6e2f45afb4905e82b5eddacf&SessionId=puucb42xfmgph2ggmhzrurlm044339",
I've trying to capture it using:
1- first a CSS/JQuery Extractor like this:
Reference Name: varGuid
CSS/JQuery expression: #Guid
Attribute: value
Match No (0 for Random): 0
Default value:
Didn't work...
2- Secondly I tried with a RegExp like that:
Reference Name: varGuid
Regular Expression: Guid=(.+?)&
Template: $1$
Match No (0 for Random): 0
Default value:
But is not capturing anything , I don't know what else to do...
Please someone help me !
UPDATING...
error:
java.net.URISyntaxException: Illegal character in query at index 268: http://srvdr.ajk.fye:27080/Art/WebP/Wep.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24/01/2015%2012:58:56%20p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=op5bra3jre2mrcvb10m04qy1093246
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:283)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1141)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1130)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:431)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258)
at java.lang.Thread.run(Unknown Source)
UPDATING with the Test Plan structure
Test Plan
User Defined Variables
HTTP Request Defaults
HTTP Cookie Manager
Thread Group
Recording Controler
Transaction Controller
HTTP REQUEST name: 30/Art/WebL/wfmLoginD.aspx
CSS/JQuerySessionId
Transaction Controller
HTTP REQUEST name: 31/Art/WebL/wfmL.aspx
Transaction Controller
HTTP REQUEST name: 32/Art/WebL/wfmL.aspx (In this request is comming the Guid as the GET parameters)
RegularExpressionGuid
Transaction Controller
HTTP REQUEST name: 33 /Art/WebL/wfmL.aspx?Title=Procesar+Instancia+Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=${idAK}&FechaInicio=24%2f01%2f2015+12%3a58%3a56+p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=${sessionid}
Debug Sampler
View Results Tree
WorkBench
HTTP(S) Test Script Recorder
In The treeview result:
The request 32 is sending this error:
GET http://srv/Art/WebL/wfmL.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24/01/2015%2012:58:56%20p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=55byogbbybhrhorbebiqudrm030702
[no cookies]
And the response of the 32 is:
java.net.URISyntaxException: Illegal character in query at index 268: http://srv/Art/WebL/wfmL.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24/01/2015%2012:58:56%20p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=55byogbbybhrhorbebiqudrm030702
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:283)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1141)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1130)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:431)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258)
at java.lang.Thread.run(Unknown Source)
And in the request 33 this error, here Guid is getting the value "h" I don't understand what's happening here
POST http://srv/Art/WebL/wfmL.aspx?Title=Procesar+Instancia+Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24%2f01%2f2015+12%3a58%3a56+p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=h&SessionId=55byogbbybhrhorbebiqudrm030702
POST data:
rsmScriptManager_TSM=%3B%3BSystem.Web.Extensions%2C+Version%3D4.0.0.0%2C+Culture%3Dneutral%2C+PublicKeyToken%3D31bf3856ad364e35%3Aes-PE%3A509f92a1-e5fd-464f-a450-13846a6c973b%3Aea597d4b%3Ab25378d2%3BTelerik.Web.UI%2C+Version%3D2012.3.1308.40%2C+Culture%3Dneutral%2C+PublicKeyToken%3D121fae78165ba3d4%3Aes-PE%3A0c62baaa-fecc-4eb5-91ff-e3de59bf8f40%3A16e4e7cd%3Aed16cbdc%3Af7645509%3A24ee1bba%3A7165f74%3Ae330518b%3A1e771326%3A8e6f0d33%3A6a6d718d%3A8674cba1%3A7c926187%3Ab7778d6c%3Ac08e9f8a%3Aa51ee93e%3A59462f1%3A874f8ea2%3Af46195d3%3A19620875%3A490a9d4e%3Abd8f85e4%3Aa7e79140&__EVENTTARGET=btnIr&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=%2FwEPDwULLTE2MTY2ODcyMjlkZHo6ihSMfi3%2Bb2BIYPR7%2Bt5A2g4O&__VIEWSTATEGENERATOR=089A3467&__SCROLLPOSITIONX=0&__SCROLLPOSITIONY=0&__EVENTVALIDATION=%2FwEdAATZZXM7aurrhLYJ0ij%2B03LaYhM0SpqGl6sQ9WQzHF7zLq7ad8Q7AL0pZvZlvE%2BM6yw6acSb565lrI%2B%2FgO9Y5T%2F8b%2BlKMjTlmm0duBT2lHLkrxDZFZg%3D&txtSalir=NO&HiddenField1
If your GUID value comes as URL CSS/JQuery extractor won't help a lot.
Make sure that you tick "URL" in "Field to check" section
Make sure that you tick "Main sample and sub-samples" in "Apply to" section
See Using RegEx (Regular Expression Extractor) with JMeter guide for detailed explanation of each configuration field.
Apart from these 2 points your regular expression configuration looks fine.
I have tried some scripting using jmeter, but I am getting issues.
Thread Name: Thread Group 1-1
Sample Start: 2014-02-10 13:57:36 IST
Load time: 1229
Latency: 0
Size in bytes: 1880
Headers size in bytes: 0
Body size in bytes: 1880
Sample Count: 1
Error Count: 1
Response code: Non HTTP response code: org.apache.http.conn.HttpHostConnectException
Response message: Non HTTP response message: Connection to http://wwwe.google.com refused
Response headers:
HTTPSampleResult fields:
ContentType:
DataEncoding: null
Please help me o this issue
You have a wrong url, change it by http://www.google.com
The request URL has stringified json
Sampler Result:
Thread Name: Thread Group 1-1
Sample Start: 2013-09-05 12:09:17 IST
Load time: 0
Latency: 0
Size in bytes: 4491
Headers size in bytes: 0
Body size in bytes: 4491
Sample Count: 1
Error Count: 1
Response code: Non HTTP response code: java.net.URISyntaxException
Response message: Non HTTP response message: Illegal character in query at index 72:
Request:
GET http://abc.com/api/api_name?XYZModelJsonString={[{},{},{},{},{},{},{},{},{},{},{},{}]{}}
[no cookies]
Response data:
java.net.URISyntaxException: Illegal character in query at index 72: http://abc.com/api/api_name?XYZModelJsonString={[{},{},{},{},{},{},{},{},{},{},{},{}]{}}
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:234)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.lang.Thread.run(Unknown Source)
Move the following:
XYZModelJsonString ={[{},{},{},{},{},{},{},{},{},{},{},{}]{}}
In the parameters table putting XYZModelJsonString in name column and the rest in value column and check encode checkbox in the column.
It will work