activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ganesh Murthy <>
Subject Re: Second instance uses wrong pid
Date Thu, 13 Aug 2015 17:40:58 GMT
I was looking at the method protected JMXServiceURL useJmxServiceUrl() throws MalformedURLException
in  org.apache.activemq.console.command.AbstractJmxCommand - 

Here is the relevant code from that method - 

                    List allVMs = (List)getVMList.invoke(null, (Object[])null);

                    for(Object vmInstance : allVMs) {
                        String displayName = (String)getVMDescriptor.invoke(vmInstance, (Object[])null);
                        if (displayName.contains("activemq.jar start")) {
                            String id = (String)getVMId.invoke(vmInstance, (Object[])null);

                            Object vm = attachToVM.invoke(null, id);

                            Properties agentProperties = (Properties)getAgentProperties.invoke(vm,
                            String connectorAddress = agentProperties.getProperty(CONNECTOR_ADDRESS);

                            if (connectorAddress != null) {
                                jmxUrl = connectorAddress;
                                connectingPid = Integer.parseInt(id);
                                context.print("useJmxServiceUrl Found JMS Url: " + jmxUrl);

The loop that goes thru allVMs seems to have a "break;" statement if the connectorAddress
is not null. So, the code might have a bug in it since it might break after the first vm in

This code has not been modified in a while. I talked to my friend and he said that "the assumption
at the time might have been to just use the first broker you find since the commands weren't
really written with the idea that they'd be dealing with multiple brokers.  If you want the
commands to work with more than one broker on the same machine there might be room for some

Pull requests are welcome.


----- Original Message -----
From: "Gerard Weatherby" <>
Sent: Thursday, August 13, 2015 9:52:53 AM
Subject: Second instance uses wrong pid

ActiveMQ 5.11.1

We have multiple instances running on the same server. This were created using the activemq
script "create" command and then changing the openwire port in activemq.xml and the web port
in jetty.xml. All transports other than openwire are commented out.
The instances are in sibling directories:
Et. al.

The correct pids are in the corresponding data/ files.

When I execute "qbio query" it finds and queries the activemq instance of a different server.
From the log message, it seems to have something to do with jmxServiceUrl, but I don't understand
what that's about. Here's the top lines of output, ending with the wrong pid:

INFO: Loading '/usr/local/apache-activemq-5.11.1/bin/env'
INFO: Using java '/usr/lib/jvm/jdk1.8.0_45/jre/bin/java'
Java Runtime: Oracle Corporation 1.8.0_45 /usr/lib/jvm/jdk1.8.0_45/jre
  Heap sizes: current=1005056k  free=989327k  max=1005056k
    JVM args: -Xms1G -Xmx1G
-Dactivemq.classpath=/usr/local/apache-activemq-5.11.1/qbio/conf: -Dactivemq.home=/usr/local/apache-activemq-5.11.1
-Dactivemq.base=/usr/local/apache-activemq-5.11.1/qbio -Dactivemq.conf=/usr/local/apache-activemq-5.11.1/qbio/conf
Extensions classpath:
ACTIVEMQ_HOME: /usr/local/apache-activemq-5.11.1
ACTIVEMQ_BASE: /usr/local/apache-activemq-5.11.1/qbio
ACTIVEMQ_CONF: /usr/local/apache-activemq-5.11.1/qbio/conf
ACTIVEMQ_DATA: /usr/local/apache-activemq-5.11.1/qbio/data
useJmxServiceUrl Found JMS Url: service:jmx:rmi://
Connecting to pid: 27587

Tech data:
Linux 2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST 2011 x86_64
x86_64 x86_64 GNU/Linux
CentOS release 6.2 (Final)

JRE 1.8.0_45

Not using an application server.


Gerard Weatherby  |  Application Architect
Center for Cell Analysis & Modeling  |  UConn Health
263 Farmington Avenue, Farmington, CT 06030-6406
Office: 860.679.2065

View raw message