* @throws SAXException error parsing the server bindings xml file
* @throws ParserConfigurationException error parsing the server bindings xml file
*/
public void configureServerBinding(String serverName) throws TransformerException, IOException, SAXException, ParserConfigurationException
{
Server server = manager.getServer(serverName);
String configHome = getProductDir();
String mbeanServiceFile = getServerPath(serverName) + "conf/jboss-service.xml";
String bindingName = server.getSysProperty("server.binding.name");
String bindingFile = server.getSysProperty("server.binding.location");
if (bindingFile == null)
return;
bindingFile = configHome + bindingFile;
// if bindingName is set then it is safe to check that the AS is up via the Naming service port
// BTW the AS5 team has changed the behavior of the naming service port - it is opened before
// all the services have been configured so any target deployments may not have been initialised
// when the server is declared as running. Instead we force the server to use a web server port to
// determine if the AS is running.
if (bindingName == null)
return;
// bindingName = ServerBindingConfig.DEFAULT_BINDING;
// else
// server.setHasWebServer(true);
ServerBindingConfig.setBinding(mbeanServiceFile, bindingName, bindingFile);
server.setRmiPort(ServerBindingConfig.lookupRmiPort(bindingFile, bindingName, server.getRmiPort()));
server.setHttpPort(ServerBindingConfig.lookupHttpPort(bindingFile, bindingName, server.getHttpPort()));
System.out.println("Using: " + Context.PROVIDER_URL
+ " = jnp://"+ server.getHost() + ':' + server.getRmiPort()
+ " and http port " + server.getHttpPort());
}