Receiving Error Code 307 while running Jmeter scripts behind proxy - jmeter

I have to conduct a PT on a mobile application.
The recording was done from personal laptop where we didn't face any problem.
However, when we transfer the PT scripts to the testing network, we are facing the following error every time we run it:-
Error in Sample Result:-
Response code: 307
Response message: Authentication Required
Response headers:
HTTP/1.1 307 Authentication Required
Date: Mon, 19 Oct 2015 09:53:21 GMT
Proxy-Connection: close
Via: 1.1 localhost.localdomain
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Error in Response Data:-
Authentication Required
Kindly help us as we have very less time to provide the results.

After several round of brainstorming, I have found out the solution.
Just ensure that the HTTP Request Implementation is set to "JAVA" and the "Redirect Automatically" is set checked-in.
The Scripts will run only for this combination.

If you're running JMeter behind the proxy you can pass credentials via command-line arguments like:
-H, --proxyHost <argument>
Set a proxy server for JMeter to use
-P, --proxyPort <argument>
Set proxy server port for JMeter to use
-N, --nonProxyHosts <argument>
Set nonproxy host list (e.g. *.apache.org|localhost)
-u, --username <argument>
Set username for proxy server that JMeter is to use
-a, --password <argument>
see Full list of command-line options for other keys which might be useful
It may be internal application under test authentication challenge, for instance it expects certain HTTP Header or Cookie. The easiest way to check it is recording the same actions one more time and inspect 2 JMX files for any differences. If they are - they need to be correlated.

Related

No valid crumb was included in the request - Jenkins on Windows

I installed Jenkins 2.46.2 on Windows Server 2012 and integrated it with GitBucket.
I am trying the trigger the build when a change is pushed to GitBucket.
I tried to add a webhook but I get this error:
Error 403 No valid crumb was included in the request
HTTP ERROR 403 Problem accessing
/jenkins/gitbucket-webhook/. Reason: No valid crumb was included
in the requestPowered by
Jetty://
This worked for me:
obtain crumb
$ wget -q --auth-no-challenge --user yourUserName --password yourPassword--output-document - 'http://myJenkins:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)'
Now Run Jenkins Job
$ curl -I -X POST http://yourUserName:yourPassword#myJenkins:8080/job/JOBName/build -H "Jenkins-Crumb:44e7038af70da95a47403c3bed5q10f8"
HTTP/1.1 201 Created Date: Fri, 28 July 2017 09:15:45 GMT X-Content-Type-Options: nosniff Location: http://myJenkins:8080/queue/item/17/ Content-Length: 0
For me the problem was that I left the jenkins window unattended for some time. Once I navigated to the jenkins root I was prompted to sign in again and was able to configure the job with git. I also enabled AUTO REFRESH in jenkins which will likely prevent this in the future.

Response code: Non HTTP response code: org.apache.http.conn.HttpHostConnectException

I am trying to run a script in jmeter . However , I am facing the below error
Response code: Non HTTP response code: org.apache.http.conn.HttpHostConnectException
It says , connection is refused to that site. But, I am able to open the site manually.
Please help.
Thanks.
My expectation is that you're sitting behind corporate proxy. Browser uses proxy to connect to the Internet and JMeter doesn't.
If this is the case you can "tell" JMeter to use the same proxy server as browser does via the following command-line arguments:
-H, --proxyHost <argument>
Set a proxy server for JMeter to use
-P, --proxyPort <argument>
Set proxy server port for JMeter to use
-N, --nonProxyHosts <argument>
Set nonproxy host list (e.g. *.apache.org|localhost)
-u, --username <argument>
Set username for proxy server that JMeter is to use
-a, --password <argument>
Set password for proxy server that JMeter is to use
See
How Do I Run JMeter in Non-GUI Mode? article for more command-line tips and tricks
Full list of command-line options - all command-line keys JMeter can understand.

Unable to login into application when using jmeter's recording controller

I'm able to login into the application, when I'm NOT recording the jmeter script using jmeter's proxy server (aka Test Script Recorder). But, as soon as I setup my browser to use jmeter's proxy server (aka Test Script Recorder) for recording, I'm NOT able to login into the application itself. I have tried adding a cookie manager, cache manager, etc.., but nothing seems to make a difference.
When NOT using the proxy (i.e., when not recording script), below are the 2 calls that are made by the browser to successfully authenticate (screenshot from Chrome developer tools):
When using jmeter's proxy (i.e., when recording script), below is the call. Looks like the call is not even made from the browser to the server, as even the remote address is not resolved and the request method is not shown.
I have recorded multiple scripts for authentication, but this is the first time I'm encountering this issue. And I've followed this guide step by step. What am I missing?
Taken from Jmeter manual,
If you are testing from behind a firewall/proxy server, you may need to provide JMeter with the firewall/proxy server hostname and port number. To do so, run the jmeter[.bat] file from a command line with the following parameters:
-H [proxy server hostname or ip address]
-P [proxy server port]
-N [nonproxy hosts] (e.g. *.apache.org|localhost)
-u [username for proxy authentication - if required]
-a [password for proxy authentication - if required]
Example : jmeter -H my.proxy.server -P 8000 -u username -a password -N localhost
You can also use --proxyHost, --proxyPort, --username, and --password as parameter names

JMeter Issue in VLAN enabled system

Once my machine is VLAN enabled, I'm neither able to prepare new scripts using JMeter-2.9 tool nor able to execute my old scripts which I used to run earlier on the same machine.
Please find below error message I got while running the old scripts:
*Thread Name: 46_Drug Issue 1-1
Sample Start: 2014-11-19 16:22:40 IST
Load time: 1001
Latency: 0
Size in bytes: 1720
Headers size in bytes: 0
Body size in bytes: 1720
Sample Count: 1
Error Count: 1
Response code: Non HTTP response code: java.net.ConnectException
Response message: Non HTTP response message: Connection refused: connect
Response headers:
HTTPSampleResult fields:
ContentType:
DataEncoding: null*
While recording a new test plan in my Windows machine, I'm able to navigate the different pages with HTTP Proxy server enabled in JMeter tool, but no HTTP request is getting recorded in the transaction controller.
Can anyone please suggest, how to overcome this issue ?
According to me issue is related to proxy.
Jmeter sits between your machine and proxy and thats how it records all the requests coming to and going from your machine. It doesnt matter you are in VLAN or WAN if your proxy settings are correct.
Please check your proxy settings once put apply similar proxy settings (Localhost,8080) in VLAN or else you can provide seperate proxy for your Jmeter by starting it with JMeter parameters,
Jmeter.bat -H <hostname> -P <port> -u <username> -a <pwd>

JMeter (Active?) FTP to VLTrader

Situation:
I'm using JMeter to load test my communications application (Cleo VLTrader). I'm new to JMeter, and have been able to get HTTP communication working, but not FTP. When I attempt to use a JMeter FTP Request sampler, I can see on the server side that the JMeter is issuing a "PASV" command, and failing shortly thereafter due to a "502 PASV command not available" error.
Question:
How do I need to configure my JMeter FTP Request sampler to connect to my FTP server?
1. Sorry for this but just to ensure: have you ensured that FTP connection succeeds manually, i.e. not from FTP Request in jmeter script but via console/telnet connection or any FTP client utility?
2. FTP Passive mode
Possible cause:
Since your FTP Request fails during PASV command execution can suppose that the root cause is that your ftp server doesn't support passive mode while jmeter's FTP Request uses passive mode by default.
To ensure this try to switch into Passive mode after connecting to your ftp from console,
e.g.
telnet your.ftp.server.url 21
USER yourusername
PASS yourpassword
PASV
or
ftp -d your.ftp.server.url
USER yourusername
PASS yourpassword
passive
or using any ftp client utility which have option to select mode (active/passive) for connection.
If the same issue appears during this - well, the problem is that your ftp server doesn't support passive mode which is used by FTP Request.
See e.g. this for explanation of differences in both the modes.
Possible solution:
As per jmeter sources:
ftp.enterLocalPassiveMode();
switch to passive mode is used by default and there is no possibility to set mode externally in FTP Request configuration screen.
But you can implement ftp request yourself, avoiding usage of FTP Request.
You can use FTPClient realization from Apache Commons Net and script ftp connection in BeanShell Sampler.
Very simplified this may look like:
import org.apache.commons.net.ftp.*;
FTPClient client = new FTPClient();
client.setDataTimeout(3600000);
client.connect(ftpHost,ftpPort);
client.login(userName, userName);
client.setFileType(FTPClient.BINARY_FILE_TYPE);
...
// FTPClient uses 'active mode' by default
if (ftp_passive_mode) {
client.enterLocalPassiveMode();
} else {
client.enterLocalActiveMode();
}
...
client.logout();
client.disconnect();
Maybe also I'm wrong and the reason of your issue hides in another place.
Hope this will help you to diagnose and solve your problem.

Resources