activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G. Bertani" <g.bert...@sol-tec.it>
Subject VMTransportServer already bound
Date Wed, 29 Apr 2009 15:53:31 GMT

I am trying to embed an ActiveMQ broker inside an application that is
exposing services via JMS. The intent is to create a cluster of brokers so
that:
- each instance of the application has its own broker via VM transport;
- each instance exposes a TCP transport to clients;
- each instance is a node of a network of brokers, where each broker
connects to the others using the TCP transport (statically configured).

So far I have been able to start one node, but when the second node starts
as soon as it tries to get a connection it gets this mind boggling
exception:

javax.jms.JMSException: Could not create Transport. Reason:
java.io.IOException: VMTransportServer already bound at: vm://null
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
        at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:239)
        at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:252)
        at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:224)
        at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:172)
        ...
Caused by: java.io.IOException: VMTransportServer already bound at:
vm://null
        at
org.apache.activemq.transport.vm.VMTransportFactory.bind(VMTransportFactory.java:201)
        at
org.apache.activemq.transport.vm.VMTransportFactory.doCompositeConnect(VMTransportFactory.java:133)
        at
org.apache.activemq.transport.vm.VMTransportFactory.doConnect(VMTransportFactory.java:53)
        at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:51)
        at
org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:80)
        at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:237)
        ... 6 more

The code that starts the embedded broker is like this:

-------------------------------
ActiveMQConnectionFactory conFactory= new ActiveMQConnectionFactory(
	"vm://" + nodeName + "?create=false&waitForStart=10000");

BrokerService activeMQ= new BrokerService();
activeMQ.setBrokerName(nodeName);

if (otherNodes.length > 0) {
	String nodesConnectorString= "static:(";
	for (String node : otherNodes)
		nodesConnectorString += "tcp://" + node.trim() + ",";
	nodesConnectorString= nodesConnectorString.substring(
		0, nodesConnectorString.length() -1) + ")";
	
	URI nodesConnectorUri= new URI(nodesConnectorString);
	NetworkConnector nodeConnector= activeMQ.addNetworkConnector(
		nodesConnectorUri);
	nodeConnector.setDuplex(true);
}

URI localConnectorUri= new URI("tcp://localhost:" + externalPort);
activeMQ.addConnector(localConnectorUri);

activeMQ.start();

ActiveMQConnection connection= 
	(ActiveMQConnection) conFactory.createConnection(); // EXCEPTION!
connection.start();
-------------------------------

I don't understand to what that "vm://null" is referring, since I created
the connection factory specifying a name for the broker (the "nodeName" is
not null). And more, I don't understand how the exception can be raised
about the VM transport, since the two nodes are on separate JVMs...

Any help would be greatly appreciated.
Thanks in advance.

   Gianluca
 

-- 
View this message in context: http://www.nabble.com/VMTransportServer-already-bound-tp23296126p23296126.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message