I'm able to restart JBoss AS 7.2.0 Final using Jboss CLI with the following command:
jboss-cli.bat --connect --controller=IP:9999 --command=:shutdown(restart=true)
Now i need to do it programmatically from a java class, i've tried using the Jboss cli API, here after my code, but it only performs a shutdonw and doesn't restart!
CommandContext ctx = null;
try {
ctx = org.jboss.as.cli.CommandContextFactory.getInstance().newCommandContext();
ctx.connectController(IP, 9999);
ctx.handle(":shutdown(restart=true)");
} catch (CommandLineException e) {
System.out.println(e.getMessage());
}
Any idea please?