@@ -, +, @@ --- .../jmeter/samplers/RemoteSampleListenerImpl.java | 11 +++++++++-- .../jmeter/threads/RemoteThreadsListenerImpl.java | 11 +++++++++-- xdocs/usermanual/remote-test.xml | 6 +++--- 3 files changed, 21 insertions(+), 7 deletions(-) --- a/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java +++ a/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java @@ -37,8 +37,8 @@ public class RemoteSampleListenerImpl extends java.rmi.server.UnicastRemoteObjec private final SampleListener sampleListener; - private static final int DEFAULT_LOCAL_PORT = - JMeterUtils.getPropDefault("client.rmi.localport", 0); // $NON-NLS-1$ + private static final int DEFAULT_LOCAL_PORT = addOffset( + JMeterUtils.getPropDefault("client.rmi.localport", 0), 2); // $NON-NLS-1$ public RemoteSampleListenerImpl(Object listener) throws RemoteException { super(DEFAULT_LOCAL_PORT, RmiUtils.createClientSocketFactory(), RmiUtils.createServerSocketFactory()); @@ -54,6 +54,13 @@ public class RemoteSampleListenerImpl extends java.rmi.server.UnicastRemoteObjec } } + private static int addOffset(int port, int offset) { + if (port == 0) { + return 0; + } + return port + offset; + } + @Override public void testStarted() { if (testListener != null) { --- a/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java +++ a/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java @@ -49,8 +49,8 @@ public class RemoteThreadsListenerImpl extends UnicastRemoteObject implements /** * */ - private static final int DEFAULT_LOCAL_PORT = - JMeterUtils.getPropDefault("client.rmi.localport", 0); // $NON-NLS-1$ + private static final int DEFAULT_LOCAL_PORT = addOffset( + JMeterUtils.getPropDefault("client.rmi.localport", 0), 1); // $NON-NLS-1$ /** * @throws RemoteException if failed to export object @@ -80,6 +80,13 @@ public class RemoteThreadsListenerImpl extends UnicastRemoteObject implements } } + private static int addOffset(int port, int offset) { + if (port == 0) { + return 0; + } + return port + offset; + } + /** * * @see RemoteThreadsListener#threadStarted() --- a/xdocs/usermanual/remote-test.xml +++ a/xdocs/usermanual/remote-test.xml @@ -92,10 +92,10 @@ there is no need to start RMI registry separately. To revert to the previous behaviour, define the JMeter property server.rmi.create=false on the server host systems.

-By default, RMI uses a dynamic port for the JMeter server engine. This can cause problems for firewalls, +By default, RMI uses dynamic ports for the JMeter server engine. This can cause problems for firewalls, so you can define the JMeter property server.rmi.localport -to control this port number. -If this is non-zero, it will be used as the local port number for the server engine. +to control this port numbers. +If this is non-zero, it will be used as the base for local port numbers for the server engine. At the moment JMeter will open up to three ports beginning with the port defined in server.rmi.localport.

Step 2: Add the server IP to your client's Properties File

Edit the properties file on the controlling JMeter machine. In JMETER_HOME/bin/jmeter.properties, --