https://issues.apache.org/jira/browse/AMQ-5121 - use jmxLocal in karaf only for jmx-based commands

This commit is contained in:
Dejan Bosanac 2014-09-18 15:25:22 +02:00
parent 357d491cbe
commit fb684db4a8
2 changed files with 5 additions and 1 deletions

View File

@ -67,6 +67,7 @@ public class ActiveMQBrokerFeatureTest extends AbstractJmsFeatureTest {
produceMessage(nameAndPayload);
System.err.println(executeCommand("activemq:bstat").trim());
assertEquals("JMS_BODY_FIELD:JMSText = " + nameAndPayload, executeCommand("activemq:browse --amqurl tcp://localhost:61616 --user karaf --password karaf -Vbody " + nameAndPayload).trim());
assertEquals("got our message", nameAndPayload, consumeMessage(nameAndPayload));
}

View File

@ -17,6 +17,7 @@
package org.apache.activemq.karaf.commands;
import org.apache.activemq.console.CommandContext;
import org.apache.activemq.console.command.AbstractJmxCommand;
import org.apache.activemq.console.command.Command;
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
import org.apache.felix.gogo.commands.Argument;
@ -42,7 +43,9 @@ public class ActiveMQCommandSupport extends OsgiCommandSupport {
try {
currentCommand.setCommandContext(context2);
// must be added first
arguments.add(0, "--jmxlocal");
if (command instanceof AbstractJmxCommand) {
arguments.add(0, "--jmxlocal");
}
currentCommand.execute(arguments);
return null;
} catch (Throwable e) {