Domain domain = Globals.get(Domain.class);
Server server = domain.getServerNamed(instanceName);
String port = null;
SystemProperty httpPort = server.getSystemProperty(http_port);
if(httpPort != null) {
port = httpPort.getValue();
} else {
//if port is not set as system property, get it from config
Config cfg = server.getConfig();
SystemProperty httpConfigPort = cfg.getSystemProperty(http_port);
if(httpConfigPort != null){
port = httpConfigPort.getValue();
}
}
if(port == null) {
throw new RuntimeException("Not able to get HTTP_LISTENER_PORT " +