How to connect a remote jms client to the integrated activemq browser in tomcat?

I have a built-in broker in tomcat that my webapp clients connect to a fine using vm: // localhost. I would like some remote clients in another jvm to be able to connect to the built-in broker. How to configure the built-in broker to listen on port #? This works for embedded clients:

server.xml fragment:

<Resource auth="Container" 
name="jms/ConnectionFactory" 
type="org.apache.activemq.ActiveMQConnectionFactory" 
description="JMS Connection Factory" 
factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
brokerURL="vm://localhost" 
brokerName="MyActiveMQBroker" 
useEmbeddedBroker="true"/>  

This does not work for remote clients, but my built-in clients still connect using vm: // localhost:

<Resource auth="Container" 
name="jms/ConnectionFactory" 
type="org.apache.activemq.ActiveMQConnectionFactory" 
description="JMS Connection Factory" 
factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
brokerURL="vm:(broker:(tcp://localhost:61616))" 
brokerName="MyActiveMQBroker" 
useEmbeddedBroker="true"/>  

My remote clients throw this error:

Failed to connect to broker url: tcp: // localhost: 61616. Reason: java.net.ConnectException: Connection refused

I also tried this:

brokerURL="vm://localbroker?brokerConfig=xbean:file:C:/temp/activemq.xml"

and in the activemq.xml file by setting this:

<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
</transportConnectors>

<networkConnectors>
<networkConnector uri="static:(tcp://0.0.0.0:61616)"/>
</networkConnectors>

, xml , . tomcat, Webapp , , :

vm://localhost

, tcp://0.0.0.0: 61616. ?

+3
1

vm://localhost tcp . vm JVM.

tomcat (, "tomcathostone" )

<Resource auth="Container" 
name="jms/ConnectionFactory" 
type="org.apache.activemq.ActiveMQConnectionFactory" 
description="JMS Connection Factory" 
factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
brokerURL="broker:(tcp://0.0.0.0:61616)" 
brokerName="MyActiveMQBroker" 
useEmbeddedBroker="true"/> 

tomcat (, "tomcathosttwo" )

<Resource auth="Container" 
name="jms/ConnectionFactory" 
type="org.apache.activemq.ActiveMQConnectionFactory" 
description="JMS Connection Factory" 
factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
brokerURL="broker:(tcp://tomcathosttwo:61616,network:static:tcp://tomcathostone:61616)" 
brokerName="MyActiveMQBroker" 
useEmbeddedBroker="true"/>
+1

All Articles