Monday, September 19, 2011

JMeter server does not send back the sampler results on Ubuntu linux

Trying to simulate distributed JMeter configuration over the virtual hosts network (virtualbox) I facedd the set of problems caused by the fact that JMeter does not correctly determine the ip address of the hosts it'r running at. For example I could not even connect to jmeter-server because it considered the local address as the localhost (127.0.0.1). Short investigation showed that the solution is placed inside the jmeter-server file. It says:

# If the client fails with:
# ERROR - jmeter.engine.ClientJMeterEngine: java.rmi.ConnectException: Connection refused to host: 127.0.0.1
# then it may be due to the server host returning 127.0.0.1 as its address

# One way to fix this is to define RMI_HOST_DEF below
#RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx

${DIRNAME}/jmeter ${RMI_HOST_DEF} -Dserver_port=${SERVER_PORT:-1099} -s -j jmeter-server.log "$@"

So uncommenting the RMI_HOST_DEF parameter and specifying the correct address solved the problem. However there were another one. When I ran the scenario I observed the errors in jmeter-server log file. It said the server couln't send back the sampler results as it tried to send it to 127.0.0.1. I couldn't find any solution in jmeter forums so I just applied the same one from jmeter-server to jmeter client.

So one should just edit the jmeter client execution linux bash script so that the last two lines will look like this:
RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx
java $ARGS $JVM_ARGS $RMI_HOST_DEF -jar `dirname $0`/ApacheJMeter.jar "$@"

Where xxx.xxx.xxx.xxx should keep the ip address you're running your jmeter client at.

No comments:

Post a Comment