localHost = InetAddress.getLocalHost();
} else {
localHost = InetAddress.getByName(host);
}
} catch (UnknownHostException e1) {
throw new RemoteException("Cannot start. Unable to get local host IP address.");
}
log.info("IP address="+localHost.getHostAddress());
String hostName = localHost.getHostName();
if (localHost.isLoopbackAddress()){
throw new RemoteException("Cannot start. "+hostName+" is a loopback address.");
}
log.debug("This = " + this);
if (createServer){
log.info("Creating RMI registry (server.rmi.create=true)");
try {
LocateRegistry.createRegistry(this.rmiPort);
} catch (RemoteException e){
String msg="Problem creating registry: "+e;
log.warn(msg);
System.err.println(msg);
System.err.println("Continuing...");
}
}
try {
Registry reg = LocateRegistry.getRegistry(this.rmiPort);
reg.rebind(JMETER_ENGINE_RMI_NAME, this);
log.info("Bound to registry on port " + this.rmiPort);
} catch (Exception ex) {
log.error("rmiregistry needs to be running to start JMeter in server " + "mode\n\t" + ex.toString());
// Throw an Exception to ensure caller knows ...
throw new RemoteException("Cannot start. See server log file.");
}
}