Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

How to run "Tutorial on Spring Remoting with JMS" on two machines?

$
0
0
Hi,
The following tutorial (Tutorial on Spring Remoting with JMS) works fine
on one machine, but unable to run from two different machines (server on one
and client on another machine).

http://camel.apache.org/tutorial-jmsremoting.html#Tutorial-JmsRemoting-TutorialonSpringRemotingwithJMS
<http://camel.apache.org/tutorial-jmsremoting.html#Tutorial-JmsRemoting-TutorialonSpringRemotingwithJMS>

I am interested in running the client from a different machine, so I have
done the following things:

1) In camel-server.xml file of first machine, I have replaced localhost
(below content) with machine's ipaddress

<broker:broker useJmx="true" persistent="false" brokerName="myBroker">
<broker:transportConnectors>

<broker:transportConnector name="vm" uri="vm://myBroker"/>

<broker:transportConnector name="tcp"
uri="tcp://localhost:${tcp.port}"/>
</broker:transportConnectors>
</broker:broker>

2) In camel-client.xml file of second machine, I have replaced localhost
(below content) with first machine's ipaddress

<bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://localhost:${tcp.port}"/>
</bean>

3) I get the following exception in the second machine mainly because of the
message

"Caused by: javax.jms.JMSException: Could not connect to broker URL:
*tcp://<first machine ipaddress>:61610*. Reason: java.net.ConnectException:
Connection timed out: connect"

I am not sure whether my approach has been correct in trying to run from a
different machine. Ultimately, I would like to run clients on separate
machines accessing Queue on the main server. Please let me know how to make
this work from two different machines.

Apache Camel 2.13.2 (CamelContext: camel-client) started in 0.375 seconds
Invoking the multiply with 11
2014-08-21 15:37:05,968 [Endpoint.main()] WARN TemporaryQueueReplyManager

Exception inside the DMLC for Temporary ReplyTo Queue for destination
numbers,
refreshing ReplyTo destination
javax.jms.JMSException: Error while attempting to add new Connection to the
pool

at
org.apache.activemq.jms.pool.PooledConnectionFactory.createJmsExcepti
on(PooledConnectionFactory.java:243)
at
org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection
(PooledConnectionFactory.java:198)
at
org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection
(PooledConnectionFactory.java:177)
at
org.springframework.jms.support.JmsAccessor.createConnection(JmsAcces
sor.java:184)
at
org.springframework.jms.listener.AbstractJmsListeningContainer.create
SharedConnection(AbstractJmsListeningContainer.java:405)
at
org.springframework.jms.listener.AbstractJmsListeningContainer.establ
ishSharedConnection(AbstractJmsListeningContainer.java:373)
at
org.springframework.jms.listener.DefaultMessageListenerContainer.esta
blishSharedConnection(DefaultMessageListenerContainer.java:765)
at
org.springframework.jms.listener.AbstractJmsListeningContainer.doStar
t(AbstractJmsListeningContainer.java:280)
at
org.springframework.jms.listener.AbstractJmsListeningContainer.start(
AbstractJmsListeningContainer.java:265)
at
org.springframework.jms.listener.DefaultMessageListenerContainer.star
t(DefaultMessageListenerContainer.java:566)
at
org.apache.camel.component.jms.reply.ReplyManagerSupport.doStart(Repl
yManagerSupport.java:229)
at
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)

at
org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:7
4)
at
org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:5
9)
at
org.apache.camel.component.jms.JmsProducer.createReplyManager(JmsProd
ucer.java:532)
at
org.apache.camel.component.jms.JmsProducer.initReplyManager(JmsProduc
er.java:105)
at
org.apache.camel.component.jms.JmsProducer.processInOut(JmsProducer.j
ava:185)
at
org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:1
50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:105)
at
org.apache.camel.impl.DefaultAsyncProducer.process(DefaultAsyncProduc
er.java:37)
at
org.apache.camel.example.client.CamelClientEndpoint.main(CamelClientE
ndpoint.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)
at java.lang.Thread.run(Thread.java:744)
Caused by: javax.jms.JMSException: Could not connect to broker URL:
tcp://<first machine ipaddress>:61610. Reason: java.net.ConnectException:
Connection timed out: connect
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSuppo
rt.java:36)
at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnectio
n(ActiveMQConnectionFactory.java:358)
at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnectio
n(ActiveMQConnectionFactory.java:303)
at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(Active
MQConnectionFactory.java:243)
at
org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection
(PooledConnectionFactory.java:251)
at
org.apache.activemq.jms.pool.PooledConnectionFactory$1.makeObject(Poo
ledConnectionFactory.java:98)
at
org.apache.activemq.jms.pool.PooledConnectionFactory$1.makeObject(Poo
ledConnectionFactory.java:78)
at
org.apache.commons.pool.impl.GenericKeyedObjectPool.addObject(Generic
KeyedObjectPool.java:1748)
at
org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection
(PooledConnectionFactory.java:196)
... 25 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja
va:339)
at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket
Impl.java:200)
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at
org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.j
ava:501)
at
org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.j
ava:464)
at
org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55)

at
org.apache.activemq.transport.AbstractInactivityMonitor.start(Abstrac
tInactivityMonitor.java:138)
at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.j
ava:58)
at
org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNe
gotiator.java:72)
at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.j
ava:58)
at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.j
ava:58)
at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnectio
n(ActiveMQConnectionFactory.java:338)
... 32 more
2014-08-21 15:37:11,031 [anager[numbers]] INFO
ultJmsMessageListenerContainer -
JMS message listener invoker needs to establish shared Connection

Thanks,
Rajiv

Viewing all articles
Browse latest Browse all 5648

Trending Articles