@Argument(index=0, multiValued=true, required=true)
private ArrayList<String> arguments = new ArrayList<String>();
protected Object doExecute() throws Exception {
CommandContext context2 = new CommandContext();
context2.setFormatter(new CommandShellOutputFormatter(System.out));
Command currentCommand = command.getClass().newInstance();
try {
currentCommand.setCommandContext(context2);
// must be added first
arguments.add(0, "--jmxlocal");
currentCommand.execute(arguments);
return null;
} catch (Throwable e) {
Throwable cur = e;
while (cur.getCause() != null) {
cur = cur.getCause();
}
if (cur instanceof java.net.ConnectException) {
context2
.print("\n"
+ "Could not connect to JMX server. This command requires that the remote JMX server be enabled.\n"
+ "This is typically done by adding the following JVM arguments: \n"
+ " -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false \n"
+ " -Dcom.sun.management.jmxremote.ssl=false \n" + "\n"