I have the error :
java.lang.NullPointerException
When i want to add a view result in tree for a post http request.
Here is what i did :
I have the last version (5.0) and i am using fedora 28. And that my first time using apache Jmeter (i read this post but that say that i have to upgrade to 2.0 but i am in 5.0)
Is that a bad configuration that i did ? Or a fedora bug ? ..
My expectation is that you need to remove the tick from the Use multipart/form-data box
If you have this enabled - JMeter sends a multipart request and your server might fail to handle it.
Also looking into the nature of your request my expectation is that you should send Content-Type header with the value of application/json. This can be done via HTTP Header Manager:
In case of further issues please update your question with the relevant part of jmeter.log file
Related
I am getting the below error when I am trying to hit a request having Method: PATCH
Using JMeter Version:-apache-jmeter-5.4.1
"java.net.ProtocolException: Invalid HTTP method: PATCH at
java.base/java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:487)
at
java.base/sun.net.www.protocol.http.HttpURLConnection.setRequestMethod(HttpURLConnection.java:596)"
It will be helpful if I get expert assistance to resolve their issue.
Thanks
You need to change "Client Implementation" to HttpClient4 either at "Advanced" tab of the HTTP Request sampler or in the HTTP Request Defaults - this way the change will be applied to all HTTP Request samplers in the HTTP Request Defaults scope
There are diffrent HTTPSampler implementations the Java one uses HttpURLConnection here. As you can see in this bug ticket it does not support PATCH
In user.properties
HTTPSampler.implementation: HttpClient4
or in jmx using
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
I have a servlet which uses Apache Http Client to make requests to a third party. This has worked for years, but I am adding a new third party that I call via the existing servlet. It is failing (404) from the servlet but works fine using command line curl from the same machine.
The really weird thing is it works against this third party's sandbox system, both from curl and from the servlet. The only difference I see in the curl output between the two cases is how the 100 Continue is returned from the third party server. When I call the sandbox server (which also works from Http Client) the headers returned look like:
< HTTP/1.1 100 Continue
< HTTP/1.1 200
When I call the test/QA system (which works from curl but not from Http Client) the equivalent lines are
< HTTP/1.1 100
< HTTP/1.1 200
As you can see, the one which works returns 100 Continue while the one which doesn't work just returns 100. As I understand it, including the message as part of the status is recommended but optional, so this is standard compliant. And I am not getting an exception, I am getting a 404 page with an HTML body which does clearly come from this third party.
I have tried activating the "wire" logging (as per their documentation - we are using log4j so added it to the existing properties file) but don't get any extra logging at all. This is why am I using curl to try and see a difference in how the third party reacts.
I tried disabling the whole 100-continue (.setExpectContinueEnabled(false) when building my RequestConfig) but it didn't help (curl also works without the 100-continue)
Does the Apache Http Client fail in some weird way if the 100 doesn't include the message? Or am I focussing on totally the wrong place?
(We are using 4.5.x branch of Apache Http Client still - I upgraded to latest 4.5.13. I can try the 5.x.x series but that would impact a lot more I guess)
It turns out the client does handle the 100 without a message fine.
The issue was a third part that worked for https://api.example.com/foo but gave 404 for https://api.example.com:443/foo! Don't ask...
The curl command included the port but curl must have stripped it out as it was the standard one. Changed my servlet to do that and it worked.
I have recorded a script and running it. But I'm receiving the following error.
HTTP Status 405 - Request method 'POST' not supported in jmeter
I'm not sure whether it is script issue or coding issue.
Our application is installed on HTTPS but security certificate not yet installed.
Could any one please help me out.
It could be one of below
The endpoint you are requesting is not supported for POST, It may support only GET, Please change the method in Jmeter to GET or the method your url supports
The endpoint may expect proper CSRF token. It might mismatch with one you recorded. So Please extract CSRF token from previous request's response and use it. You can do via RegEx Extractor in Jmeter.
JMeter does support POST method so it may be due to:
Endpoint you're using doesn't support POST method (it expects other method(s) like GET, PUT, DELETE, etc.)
You're sending not properly configured request.
The most common reason is missing relevant Content-Type header. You can use HTTP Header Manager in order to send the relevant Content-Type header which is usually application/json for REST or text/xml or similar for SOAP.
See Testing SOAP/REST Web Services Using JMeter article for more information on API testing using JMeter.
You can also consider the following approach:
Use specialized Web Services testing tool like SoapUI or RESTClient to fire a request
Either use aforementioned tool or 3rd-party sniffer like Wireshark to capture the request
Configure JMeter to send exactly the same request
I'm using IBM Websphere 7 and am running into a problem when I try to add a value to the http header (X-UA-Compatible : IE=edge,chrome=1). It is telling me that the response has already been committed and the value cannot be added. If there is a configuration that you could setup in Websphere 7 to automatically add this to the response header that would be perfect.
The solution that I came up with was to create a filter that would execute early on in the processing of the request. That filter would add the values to the response header. It's a workaround and wasn't exactly what I was looking for, but it works for now.
i am working on java with Netbeans IDE and glassfish 3.1.2 i have created in rest services using jaxrs. when request from client is made ,i need to send json data in compressed format.to do this i have enabled the compression in glassfish as shown the following picture
but response got from the server is not compressed using gzip. it is receiving as normal json data. what should i do to overcome this issue
This is a solution for GF 3.1.2.2.
Responses to HTTP requests in version 1.0 are not compressed. You must send your requests in HTTP 1.1 to get gzipped responses from your glassfish server.
More over, you must add the header "Accept-Encoding: gzip" in your http requests.
To get a compressed response you need to have both sides agree to use it. You have configured GlassFish to send compressed responses. I can see that from the picture.
You need to make sure that your request to the services tells GlassFish that it can accept a compressed response. You normally do this by adding the following header to your HTTP requests: Accept-Encoding. You can read about the header in the RFC document that defines HTTP 1.1 request headers.
You can also get a lot of info from reading though SO questions about Accept-Encoding.