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.
Related
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
Using this tutorial, I am trying to run Jenkins cli in a windows 10 laptop as shown below. But, I am getting an exception. How do I find out why the exception occurs and how to fix it ?
Note that I first ran my jenkins.war on port 9090. Then, I moved it into tomcat webapps. Tomcat runs on port 8080.
C:\mystuff\jenkins-cli>java -jar jenkins-cli.jar -s http://localhost:9090/
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)
at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:71)
at hudson.cli.CLI.plainHttpConnection(CLI.java:279)
at hudson.cli.CLI._main(CLI.java:271)
at hudson.cli.CLI.main(CLI.java:83)
You should check the exact url and address of the Jenkins instance inside your tomcat.
If you can access the web UI at, for example, http://localhost:8080/jenkins you should run your client as:
java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/
Is running the cli over ssh an Option for you ?
If yes try the following:
Install putty on client machine
Generate open ssh key with puttygen, save private key
Copy the key to the user which should rum the cli (Userpage=> configure => SSH Public Keys
Activate ssh under global security with Static Port
Check if you can connect to your Server via ssh (you can use plink for that, comes with putty)
plink.exe -P Port_from_point_4 -no-antispoof -batch -i "Path_to_private_key_point_2" user#Jenkins-IP help"
You can use this command for open the jankins
java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/
but you need to login automatically you can read about SSO on Jenkins
or you are trigger job on Jenkins you can read to use API
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.
I have configured fitnesse plugin [version 1.4] with Hudson.
I have set it up to start a new fitnesse server on every job run. Everything work fine when i configure job to run on Hudson Master but when i configure job to run on Hudson slave. I get following error :
Connnecting to http://localhost:9998/somepath?test&format=xml&includehtml
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:411)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:525)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:208)
at sun.net.www.http.HttpClient.New(HttpClient.java:291)
at sun.net.www.http.HttpClient.New(HttpClient.java:310)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:987)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at hudson.plugins.fitnesse.FitnesseExecutor.getHttpBytes(FitnesseExecutor.java:225)
at hudson.plugins.fitnesse.FitnesseExecutor$1.run(FitnesseExecutor.java:202)
at java.lang.Thread.run(Thread.java:662)
Any suggestions to resolve this?
Did you try connecting connecting it with a different port? It could be that the port is being by some other application and you aren't aware of that. It has happened to me a couple of times.
I was getting the exact same error as you described and it turned out that restarting the server hosting FitNesse cleared out the problem, I believe that a connection was never terminated correctly by the FitNesse Service and therefore new connection were refused. Hopefully this helps someone.
I have been trying to setup aws ec2 machines for load testing of my web server using jmeter but I am stuck. I have a jmeter client on my local machine and I want to set up multiple jmeter-server nodes on ec2 to do the load testing and I am, thus far, just trying to get one server node up and running. But it hasn't worked out for me yet.
I have the same jmeter running on my local machine and the server and the java version was a little different but I don't think that is the problem. Most of the people have had problems with getting the correct ip for connecting between the client and the server nodes but I, after a lot of searching, have gotten through all those problems. I am stuck at when the server node attempts to return the result and tries to connect to the client, my local machine. The server tries to connect to the external ip address of my local machine. But it throws a connection refused error, which apparently was caused by connection timeout. I guess it's some firewall issue but I tried turning off the firewall on my local machine but it still throws the same error. I am not sure how can I get past this and it's taking way too much time then it should.
Could somebody please suggest me something to solve this? Thanks!
My local machine is a Mac OS X 10.7.5 and my server nodes are on ubuntu.
This is the error that it throws:
2013/01/29 12:23:37 ERROR - jmeter.samplers.RemoteListenerWrapper: testStarted(host) java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.10; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128)
at org.apache.jmeter.samplers.RemoteSampleListenerImpl_Stub.testStarted(Unknown Source)
at org.apache.jmeter.samplers.RemoteListenerWrapper.testStarted(RemoteListenerWrapper.java:83)
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:226)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:349)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
at java.net.Socket.connect(Socket.java:546)
at java.net.Socket.connect(Socket.java:495)
at java.net.Socket.<init>(Socket.java:392)
at java.net.Socket.<init>(Socket.java:206)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 8 more
Well, I finally solved the problem. I ended up using ssh reverse tunnels. I am not sure if there is a better way to do this though. So, in case anyone has a similar problem, this is how I did it:
Create a reverse ssh tunnel from the server to the client. So, at client side:
ssh -Nf -R [client.rmi.localport]:localhost:[client.rmi.localport on serverside] user#server
start server and have a client.rmi.localport as well; the port at which the tunnel was created;
start the client as: ./bin/jmeter-server -Djava.rmi.server.hostname=127.0.0.1.
And that's it! You have your distributed testing ready.
Solution that worked for me on Linux/OSX:
1.On the client edit bin/jmeter.properties and add:
remote_hosts=127.0.0.1:55501
client.rmi.localport=55512
mode=Batch
num_sample_threshold=250
2.On the server edit bin/jmeter.properties and add:
server_port=55501
server.rmi.localhostname=127.0.0.1
server.rmi.localport=55511
3.Now connect to the server using this ssh tunel:
ssh -L 55501:127.0.0.1:55501 -L 55511:127.0.0.1:55511 -R 55512:127.0.0.1:55512 user#hostname
4.Edit jmeter-server script to start jmeter.sh
${DIRNAME}/jmeter.sh ${RMI_HOST_DEF} -Dserver_port=${SERVER_PORT:-1099} -s -j jmeter-server.log "$#"
5.Now run on the server:
bin/jmeter-server -Djava.rmi.server.hostname=127.0.0.1
6.And on the client run jmeter with gui or add -n if gui is not needed:
bin/jmeter.sh -Djava.rmi.server.hostname=127.0.0.1
or, with test plan:
bin/jmeter.sh -Djava.rmi.server.hostname=127.0.0.1 -t /path/to/test-plan.jmx
Looks like you have to move your jmeter-master instance (jmeter client) to EC2 instance too.
As per JMeter Distributed Testing Step-by-step:
2. check all the clients are on the same subnet;
For distributed testing to work, the systems must be on the same subnet, otherwise RMI will not be able to connect.
Looks like to be your case: jmeter-slaves are in one subnet (EC2) and jmeter-master in another (your local workstation).
I wrote a free, open source script to help do exactly this. I went through the same issues listed by the OP and, even though I did get things working in the end, it was never great and I wanted something to automate away the hassle.