java.net.URISyntaxException: Illegal character in query at index 72 - jmeter

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

Related

How to generate Dashboard report for existing JMeter csv/jtl files with tab delimiter

I am trying to generate JMeter Dashboard graph for existing results i.e., csv/jtl files.
Following is the csv file content (temp1.csv):
timeStamp elapsed label responseCode responseMessage threadName dataType success failureMessage bytes grpThreads allThreads Latency
1475842232895 1158 HTTP Request 200 OK Thread Group 1-1 text true 22175 1 1 911
1475842234094 529 HTTP Request 200 OK Thread Group 2-1 text true 682 1 1 529
Following is the command I ran:
jmeter -g J:\temp_ws\temp1.csv -o J:\temp_ws\temp1
and delimiter set to , in user.properties
jmeter.save.saveservice.default_delimiter=,
It is giving the following error I got (from JMeter.log file)
FATAL - jmeter.JMeter: An error occurred: org.apache.jmeter.report.dashboard.GenerationException: Error while processing samples:Consumer failed with message :No column <timeStamp> found in sample metadata <timeStamp elapsed label responseCode responseMessage threadName dataType success failureMessage bytes grpThreads allThreads Latency>, check #jmeter.save.saveservice.* properties to add the missing column
at org.apache.jmeter.report.dashboard.ReportGenerator.generate(ReportGenerator.java:245)
at org.apache.jmeter.JMeter.start(JMeter.java:478)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.jmeter.NewDriver.main(NewDriver.java:259)
Then tried to change the delimiter to \t in user.properties and run the command again to generate the report, I got the following error:
2016/10/07 17:59:32 FATAL - jmeter.JMeter: An error occurred:
java.lang.ExceptionInInitializerError
at org.apache.jmeter.JMeter.start(JMeter.java:477)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.jmeter.NewDriver.main(NewDriver.java:259)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at org.apache.jmeter.report.dashboard.ReportGenerator.<clinit>(ReportGenerator.java:79)
... 6 more
Please help me how to generate the Dashboard report for tab delimited Jmeter results (either csv/jtl)
Note: For comma delimiter, Dashboard reports are getting generated.
You're facing a bug of 3.0:
https://bz.apache.org/bugzilla/show_bug.cgi?id=60125
It is fixed in nightly build and will be available in 3.1 coming soon.
Meanwhile you can use Nightly Builds:
http://jmeter.apache.org/nightly.html

When I am sending get method request in jmeter its giving me an error java.net.URISyntaxException: Illegal character in path at index

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"}]}

Derby "&" is not working

Select distinct APP.bca_cart.InventoryCode,APP.bca_cart.InventoryID,APP.bca_cart.CartID,APP.bca_cart.InvoiceID,APP.bca_cart.UnitPrice,APP.bca_cart.DateAdded,APP.bca_cart.CustomSku,APP.bca_cart.InventoryCode & '-' & APP.bca_cart.CustomSku AS fullsku,APP.bca_cart.Qty AS O_QTY,APP.storage_clientvendor.FirstName,APP.storage_clientvendor.LastName,APP.storage_clientvendor.Name FROM ((APP.bca_iteminventory INNER JOIN (APP.bca_cart INNER JOIN APP.bca_invoice ON APP.bca_cart.InvoiceID = APP.bca_invoice.InvoiceID) ON APP.bca_iteminventory.InventoryID = APP.bca_cart.InventoryID)INNER JOIN APP.storage_clientvendor ON APP.bca_invoice.ClientVendorID =APP.storage_clientvendor.ClientVendorID) Where APP.bca_iteminventory.StoreTypeID <= 0 AND APP.bca_iteminventory.ItemTypeID NOT IN (5,4,6) AND APP.bca_iteminventory.companyId =18 ORDER BY APP. storage_clientvendor.LastName ASC
I am getting following Stacktrace. please help me to solve this error.
SEVERE: null
java.sql.SQLSyntaxErrorException: Syntax error: Encountered "&" at line 1, column 145.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)
at com.bzcomposer.global.tables.tblItemLoader.getBackOrderItemListByCustomer(tblItemLoader.java:8488)
at com.bzcomposer.items.ItemListPanel$BackOrderItemModel.setTableData(ItemListPanel.java:4424)
at com.bzcomposer.items.ItemListPanel$BackOrderItemModel.<init>(ItemListPanel.java:4407)
at com.bzcomposer.items.ItemListPanel.<init>(ItemListPanel.java:140)
at com.bzcomposer.modules.internalPanel.SalesPanels.<init>(SalesPanels.java:90)
at com.bzcomposer.modules.internalPanel.InternalPanelsControl.init_internalPanel1(InternalPanelsControl.java:162)
at com.bzcomposer.modules.MainFrame2.init_internalframe1(MainFrame2.java:1104)
at com.bzcomposer.modules.MainFrame2.invokeInit(MainFrame2.java:816)
at com.bzcomposer.modules.MainPanel$1.run(MainPanel.java:393)
Caused by: java.sql.SQLException: Syntax error: Encountered "&" at line 1, column 145.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 17 more
Caused by: ERROR 42X01: Syntax error: Encountered "&" at line 1, column 145.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)
i search a lot on internet but still i am not getting solution of it.
I guess you would like to concatinate the strings by using &.
For concatination you have to use ||
APP.bca_cart.InventoryCode || '-' || APP.bca_cart.CustomSku

Jmeter how to capture a Guid value comming in the GET params (querystring)

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.

JMeter - Trouble sending HTTP request with POST variable?

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.

Resources