5

I am using ActiveMQ 5.3.2 and 5.6.0. In ActiveMQ 5.3.2, the default settings for JMX is

SUNJMX="-Dcom.sun.management.jmxremote"

In ActiveMQ 5.6.0, the default settings for JMX is

ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"

So, these settings have no port definition. Could you tell me ActiveMQ is really starting JMX connection with these settings? If so, what is the default port to connect as I cannot connect to 1099. If port is randomly selected, how to find the port which ActiveMQ is using?

Thanks.

Lwin Htoo Ko
  • 2,326
  • 4
  • 26
  • 38
  • 4
    See http://stackoverflow.com/questions/516142/does-java-6-open-a-default-port-for-jmx-remote-connections as the JMX options relate to the JVM and are not ActiveMQ specific. – Mark Nov 20 '12 at 08:55

3 Answers3

10

Default port is 1099. This can be override by passing jmx parameters as argument to activeMQ in activeMQ start script(activemq.bat or .sh file) . Use property

Dcom.sun.management.jmxremote.port for setting JMX port

Dijesh
  • 334
  • 2
  • 11
  • Even though the start command has the _-Dcom.sun.management.jmxremote_ parameter, I suppose you have to assure that the broker config has the flag _useJmx="true"_. Am I right ? – Victor Sep 04 '19 at 08:35
1

if you run ActiveMQ Broker in a Spring Boot, this is a simple way to configure the JMX port to the value 11099:

    BrokerService broker = new BrokerService();

    broker.getManagementContext().setConnectorPort(11099);
    broker.getSystemUsage().getStoreUsage().setLimit(100_000_000L);
    broker.getSystemUsage().getTempUsage().setLimit(100_000_000L);

    TransportConnector connector = new TransportConnector();
    connector.setUri(new URI("tcp://localhost:61616?wireFormat.maxInactivityDuration=3000000&wireFormat.maxInactivityDurationInitalDelay=1000000"));

    broker.addConnector(connector);
    broker.start();
Pierluigi Vernetto
  • 1,954
  • 1
  • 25
  • 27
0

By default it doesn't appear to bind to a "default activemq jmx port" however you can modify the activemq file (or environment variables to add one). JMX if you don't specify a port doesn't open one by expicitly stating one.

For instance uncomment this line (or an equivalent in the activemq file for older versions)

 # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099 "

So I guess you could think of that as the "default if you uncomment its config line".

Also when you issue a "stop" command and it doesn't pass a --jmxurl (default is port 11099 in the activemq version I run) it does default to attempting to contact service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi even though the default config isn't listening on that port without modifying configs first. Weird.

rogerdpack
  • 62,887
  • 36
  • 269
  • 388