Jmeter Uncaught exception: java.lang.NullPointerException - jmeter

I am trying to record REST requests with "http(s) test script recorder". It's working properly and record the request until i keep "Capture HTTP Headers" checked. Since I want to keep header common with some variable throughout requests and wanted to put dynamic parameter I don't want http header to be recorded everytime.
To do so, I remove that checkbox "Capture HTTP Headers", now none of my requests are getting recorded. And application is throwing exception
I am using https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf to record the requests.
ERROR - jmeter.JMeter:
Uncaught exception: java.lang.NullPointerException
at org.apache.jmeter.protocol.http.proxy.ProxyControl.replaceValues(ProxyControl.java:1275)
at org.apache.jmeter.protocol.http.proxy.ProxyControl.deliverSampler(ProxyControl.java:567)
at
org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:291)

I logged the bug with jmeter issue tracker.
They have suggested a solution to recompile the source with these 2 file changes.
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
jmeter/trunk/xdocs/changes.xml
Actual Bug https://bz.apache.org/bugzilla/show_bug.cgi?id=58453
Thanks,

Related

Using JMeter 5.4.1 recording .Net application gets either wrong response or Error response Code: 500

Using:
JMeter version 5.4.1
Browsers:
MS Edge 94.0
Google Chrome: 94.0
FireFox: 92.0.1
Using JMeter to record .Net application. 90% of the recording was perfectly fine. no page crashed and received the response correctly. Except, when I made any requests that related to permission.aspx or permission.asp page I got error message have shown below or wrong response content displayed on the page.
I did try to change the record type from httpclient4 to Java but it didn't help.
Also Error log from JMeter log showed: Cause: java.io.IOExeption: Server returned HTTP response code: 500 for URL: https://xxxx.xx.xx.com/
USERID:
ASP.Net EXCEPTION:
StatusCode:
200
Error Message:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
Inner Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
Your question provide sufficient level of details so I doubt you will get a comprehensive answer, it looks like JMeter isn't capable of handling some specific setup of your application.
In order to get more information you could:
Increase logging level verbosity for JMeter's HTTP(S) Test Script Recorder by adding the next line to log4j2.xml file:
<Logger name="org.apache.jmeter.protocol.http.proxy" level="debug" />
then inspect jmeter.log file for any suspicious entries
Check your application logs as HTTP 5xx errors are server-side errors so most probably the reason can be found there
You might also want to try out an alternative way of recording a JMeter test: JMeter Chrome Extension which is kind of less "invasive" and "alien" to the browser than JMeter's proxy server.

JMeter's HTTP Request file throws 404 error

JMeter HTTP Request - 404 ERROR
While I run my jmx file, It throws a 404 error for one of the HTTP Request file. Screen shot is given above.
Can anyone please suggest some solution for this issue.
There is an embedded resource call for the /favicon URL which is not found therefore the request fails.
You should raise an issue as HTTP 404 errors might cause SEO consequences so your site will rank lower
If you don't care about the embedded resources errors you can add the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
JMeter restart will be required to pick the property up.

How do I avoid the "java.util.zip.ZipException: Not in GZIP format" error while using JMeter 2.12

I'm trying to record my interactions with a SAAS website using JMeter 2.12. I get the following error trace as soon as I try to login:
java.util.zip.ZipException: Not in GZIP format
at java.util.zip.GZIPInputStream.readHeader(Unknown Source)
at java.util.zip.GZIPInputStream.(Unknown Source)
at java.util.zip.GZIPInputStream.(Unknown Source)
at org.apache.http.client.entity.GzipDecompressingEntity.decorate(GzipDecompressingEntity.java:56)
at org.apache.http.client.entity.DecompressingEntity.getDecompressingStream(DecompressingEntity.java:68)
at org.apache.http.client.entity.DecompressingEntity.getContent(DecompressingEntity.java:82)
at org.apache.http.client.entity.GzipDecompressingEntity.getContent(GzipDecompressingEntity.java:41)
at org.apache.http.conn.BasicManagedEntity.getContent(BasicManagedEntity.java:89)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:348)
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.proxy.Proxy.run(Proxy.java:236)
Blockquote
I searched for the solution and found one in BugZilla: Bug 51918 where it says to turn off the concurrent download. I tried that by unchecking the "Retrieve All Embedded Resources" option in the 'HTTP Requests Defaults'- but still getting the error and cannot proceed.
Can anyone please help? Thanks a lot!
--Ishti
Ok, I think I got an answer. Thanks to Bhargav in his post where he basically told to change the 'HTTP sampler settings' (in the HTTP test script recorder) to 'Java'. I tried that and it's not giving me the error anymore. I can proceed. Thanks!
I got into this problem in JMETER this week. The solution that worked for me in current version is.
In the header manager add:
Accept-Encoding: gzip;q=0,deflate,sdch
The server will send you a response that JMETER can handle.
I got this error on a Web application (Genexus WebApp) when it sent me an HTTP 403 error code with invalid encoding.
So to troubleshoot the problem I use two approaches:
First, turn on the log level to DEBUG, and enable the Log Viewer:
With this we can see the current payload in the Viewer:
Another alternative is to set the accept-encoding to identity, to receive the payload uncompressed.
So after that, I figured out the problem was my request (invalid params)

JMeter: HTTPJavaImpl clogs the logs with redundant errors

While running a stress test against an HTTP server which has an authentication process (401+challenge,200) I get the JMeter (v2.11) log full of these:
2015/02/17 13:52:48 ERROR - jmeter.protocol.http.sampler.HTTPJavaImpl: readResponse: java.io.IOException: Server returned HTTP response code: 401 for URL: http://w1-load1:8080/perftest/login
2015/02/17 13:53:04 ERROR - jmeter.protocol.http.sampler.HTTPJavaImpl: Cause: java.io.IOException: Server returned HTTP response code: 401 for URL: http://w1-load1:8080/perftest/login
2015/02/17 13:53:08 INFO - jmeter.protocol.http.sampler.HTTPJavaImpl: Error Response Code: 401
I don't mind the HTTP 401 , I handle those in the next request (by design)
in the BeanShell post processor I read these 401 and "make" them ok (using prev.setResponseOK() ).
setting the response code in the BeanShell doesn't prevent the initial IOException.
The problem occur also when not using BeanShell at all.
However, under stress,with many threads, these errors cost me 10% of JMeter output rate (tested against a service which doesn't return 401).
I saw that the rate of error in the JMeter log is approximately 20 lines/sec.
tested also with JMeter remote agents.
can some one explain how to avoid those log lines or how I can remove them ?
if I fail to write the BeanShell directive the log gets even larger exception:
and the request is considered a failure.
The Log Messages format is probably
#log_format=%{time:yyyy/MM/dd HH:mm:ss} %5.5{priority} - %{category}: %{message} %{throwable}
In this case the logging is not from BeanShell but jmeter.protocol.http.sampler.HTTPJavaImpl.
You can control this logging in the JMeter properties file or user properties file.
The logging configuration file is well documented in the source of the jmeter.properties file.
You can turn down logging by controlling at the package or class level.
Anything that is below this package name will only log on FATAL_ERROR
log_level.jmeter.protocol.http=FATAL_ERROR
Or at that class level, only impacting the HTTPJavaImpl
log_level.jmeter.protocol.http.sampler.HTTPJavaImpl=FATAL_ERROR
I tested the following using this load test and JMX just changing the Implementation to see the different log statements.
Finally in your case your are using HTTPJavaImpl, if you were to use HTTPClient4 the logging is a bit different and does not seem to log 401 return values or treat them as exceptions.
jmeter.properties: you can change the Sampler implementation:
jmeter.httpsampler=HTTPSampler2

Application login fails while running JMeter proxy

my test app is opencart, I am unable to record login scenario for open cart. The scenario is, if i provide a username/password while proxy recording is off, works fine. But when i've started recording and providing the username/password will not work
The response data says
Notice: Undefined index: email in D:\Program
Files\wamp\www\opencart\catalog\controller\account\login.php on
line 201Notice: Undefined index: password in
D:\Program
Files\wamp\www\opencart\catalog\controller\account\login.php on
line 201Notice: Undefined index: email in D:\Program
Files\wamp\www\opencart\catalog\controller\account\login.php on
line 205
another error message displayed is
java.lang.IllegalArgumentException: Unexpected method:
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:252)
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.proxy.Proxy.run(Proxy.java:211)
Apart from that other recording is working fine, clicking links navigating to another page all works fine
Provide Http sampler settings type as HttpClient3.1 in proxy
The issue you are facing seems to come from an unexpected HTTP Method used.
It seems to be none of:
POST
PUT
HEAD
TRACE
OPTIONS
DELETE
GET
PATCH
Can you give more details on it ?

Resources