Not able to record external applications like google using Jmeter 2.11 - jmeter

I am not able to record external applications like Google from my office network. I tried the proxy setup pdf that is provided by Jmeter support, but still I am facing the issue. I am able to record for my company internal application.
the error I am facing in browser when I am trying to record the external application is as below
java.net.UnknownHostException: www.google.com at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source) at java.net.InetAddress.getAddressesFromNameService(Unknown Source) at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45) at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:481) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:298) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105) at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:236)
Please help me to resolve this issue.

It looks like that your JMeter instance isn't capable of connecting to the Internet. My expectation is that you're behind a corporate proxy.
So for successful recording follow the next steps:
Launch JMeter providing several proxy-related command line arguments, to wit
-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 chapter 2.4.2 of JMeter's user manual for more details on Using a HTTP(S) Test Script Recorder
Configure your browser to use JMeter host and port as a proxy. Given that browser and JMeter are on the same machine example configuration of Firefox browser is below:
Another easier option to record JMeter test is using JMeter Google Chrome Extension, in that case you won't need to worry about proxy settings, SSL certificates, etc. and will be able to follow your test steps in Chrome browser and export recorded test into JMeter .jmx file.

Related

Jmeter RTE Plugin Connection timed out: connect

I'm trying to use Jmeter RTE Plugin to make mainframe tests.
Using a pconn or wc3270, it`s connects good but trying to record or using an existent JMX file, i'm getting a connection exception.
There is any other configuration that I need to do?
com.blazemeter.jmeter.rte.core.exceptions.RteIOException: Communication error wit server: 192.168.2.2
at com.blazemeter.jmeter.rte.core.listener.ExceptionHandler.throwAnyPendingError(ExceptionHandler.java:41)
at com.blazemeter.jmeter.rte.protocols.tn3270.Tn3270Client.connect(Tn3270Client.java:159)
at com.blazemeter.jmeter.rte.sampler.RTESampler.buildClient(RTESampler.java:617)
at com.blazemeter.jmeter.rte.sampler.RTESampler.sample(RTESampler.java:516)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method)
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:608)
at com.bytezone.dm3270.streams.TerminalServer.run(TerminalServer.java:48)
... 1 more
I already tried; reinstall jmeter, java, get a jmeter working installation and script but nothing fixed that issue.
Configs of wc3270 and rte plugin
Unfortunately we're not able to help without seeing your wc3270 and RTE Config (or RTE Recorder) configuration details.
The exception means that JMeter cannot connect to the host 192.168.2.2 on the given port so I would recommend double checking that you can reach that host using telnet or equivalent.
You can also enable debug logging and see whether jmeter.log file contains any clues.
And finally you can check out Testing Mainframe Environments Using Open Source Tools and cross check it with your setup, maybe you're missing something obvious.
Coming back on this thread to share the solution and add an information.
My jmeter test it`s connecting through VPN connection and the problem it was Java trying to use IPv4 over IPv6 for IPv4 connections.
resolution: setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true

Getting connection abort and fatal alert error while recording in jmeter

I am unable to record a script using JMeter and getting connection abort and fatal alert.
JMeter log:
2018-02-13 13:41:24,653 WARN o.a.j.p.h.p.Proxy: [54571] Problem with SSL certificate for url for 'api.amplitude.com'? Ensure browser is set to accept the JMeter proxy cert: Software caused connection abort: recv failed
2018-02-13 13:41:39,823 WARN o.a.j.p.h.p.Proxy: [54636] Problem with SSL certificate for url for 'api.amplitude.com'? Ensure browser is set to accept the JMeter proxy cert: Received fatal alert: unknown_ca
2018-02-13 13:41:40,868 WARN o.a.j.p.h.p.Proxy: [54650] Problem with SSL certificate for url for 'code.jquery.com'? Ensure browser is set to accept the JMeter proxy cert: Software caused connection abort: recv failed
The main reason for this error is incorrect configuration of your browser, you need to import JMeter's self-signed certificate into the browser, the file is called ApacheJMeterTemporaryRootCA.crt and it's generated in "bin" folder of your JMeter installation when you launch HTTP(S) Test Script Recorder. See HTTPS recording and certificates chapter of JMeter User Manual for more information on the concept and instructions on how to install JMeter's certificate into different browsers. I would also recommend checking out Recording HTTPS Traffic with JMeter's Proxy Server article for more details.
If your application doesn't use HTTPS and the call to api.amplitude.com is generated as a result of parsing embedded resources you can simply exclude this URL from recording by adding it to URL Patterns to Exclude field of the HTTP(S) Test Script Recorder like:

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

Problems recording http requests in Jmeter

I'm trying to record my use of a web application, so that I can replicate it for the purpose of load tests. I've never used JMeter before, so I wanted to start with a simple example.
I follow this tutorial: http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf and when I get to step 23 (navigating to a webpage), the page gives me back an error:
org.apache.http.conn.HttpHostConnectException: Connection to http://jmeter.apache.org refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:481) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:298) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105) at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:236) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) at java.net.Socket.connect(Socket.java:579) at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) ... 10 more
Has anyone seen this problem before? Have I made a mistake in the proxy-config?
At "step 18. Address – enter “localhost” or the IP address of your system"
I entered localhost, even though the web app I'm recording (http://jmeter.apache.org/index.html) isn't deployed locally. Is that a mistake?
Can anyone give me more insight?
No this is not a mistake. Enter localhost as your proxy.
Also make sure your Testscript recorder is actually on and recording.
Follow The steps mentioned below:
Open Commandline.
Goto the location where the JMeter files are coppied.
Run the following command: jmeter -H proxyname -P 8080 -u username -a password -N localhost (username, password, localhost are optional).
This opens JMeter in UI mode.
Now, follow usual steps to record the application.
Bear in mind that, as it says in the user manual:
Parameters provided on a command-line may be visible to other users on the system.

Resources