camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stan Lewis <stle...@progress.com>
Subject Re: Camel 2.0 & ActiveMq: connection refused (tcp://localhost:61616) !!
Date Tue, 28 Jul 2009 01:19:43 GMT
Hi Dhill,

In recent activemq versions the URL parameter also specifies what
network interface the broker will bind it's listen port to.  Your
broker appears to be bound to dev1 and I would guess that in your
/etc/hosts "localhost" is only 127.0.0.1, so you get a connection
refused error as you're trying to connect to 127.0.0.1:61616.  Try
specifying either the actual hostname in your xbean.xml for the broker
URL *or* modify the broker's configuration so that it uses 0.0.0.0
which should cause it to bind to all network interfaces, much like
your ssh or http daemon is in that netstat output.

Thanks,

Stan

On Mon, Jul 27, 2009 at 8:55 PM, dh1ll<dhill@ahbelo.com> wrote:
>
> Adrian,
>   I have a similar situation (although not fixed with the vm://localhost
> URL) and I don't understand this answer.  When I start up servicemix I can
> do a 'netstat -l' and see the following:
>
> Proto Recv-Q Send-Q Local Address           Foreign Address         State
> tcp        0      0 *:www                   *:*              
      LISTEN
> tcp        0      0 *:ssh                   *:*              
      LISTEN
> tcp        0      0 dev1:ipp                *:*                
    LISTEN
> tcp6       0      0 [::]:8192               [::]:*              
   LISTEN
> tcp6       0      0 [::]:57058              [::]:*              
   LISTEN
> tcp6       0      0 [::]:rmiregistry        [::]:*                
 LISTEN
> tcp6       0      0 dev1:61616              [::]:*              
   LISTEN
> tcp6       0      0 [::]:ssh                [::]:*              
   LISTEN
> tcp6       0      0 [::]:48889              [::]:*              
   LISTEN
>
> and I can also see the Queue in my jconsole.  Wouldn't this mean my broker
> has been started?
>
> If so, I would imagine I have a different reason for getting the same error.
>
> my xbean.xml looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
>       xmlns:ahc="com.mycompany.soa"
>       xmlns:amq="http://activemq.org/config/1.0"
>       xmlns="http://www.springframework.org/schema/beans"
>       xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
>       xsi:schemaLocation="http://servicemix.apache.org/jms/1.0
> http://servicemix.apache.org/schema/servicemix-jms-3.2.3.xsd
>       http://activemq.org/config/1.0
> http://activemq.apache.org/schema/core/activemq-core-4.1.1.xsd
>       http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>
>    <jms:provider       service="ahc:jms"
>                                        endpoint="provider"
>                                        destinationName="employeeUpdate.queue"
>                                        connectionFactory="#connectionFactory"
/>
>
>    <jms:consumer       service="ahc:jms"
>                                        endpoint="consumer"
>                                        destinationName="employeeUpdate.queue"
>                                        connectionFactory="#connectionFactory"
>                                        targetService="ahc:jms"
>                                        targetEndpoint="consumer"
/>
>
>    <amq:connectionFactory id="connectionFactory"
> brokerURL="tcp://localhost:61616"/>
>
> </beans>
>
>
>
> I get the same Connection Refused error:
>
> java.net.ConnectException: Connection refused: connect
>
> when trying to connect.  I have also tried tcp://0.0.0.0:61616 in my
> xbean.xml as well as setting the server hostname & 0.0.0.0 for the
> activemq.host property in servicemix.properties conf file.  No luck.  Any
> help is appreciated.
>
> DHill
>
>
>
>
>
> Adrian Trenaman-2 wrote:
>>
>> Hi Charles,
>>
>> Yup - you don't have a broker started ,so it can't make the connect
>> when you use "tcp://localhost:61616" as the broker Url.
>>
>> When you use the vm://localhost URL, ActiveMQ will lazily create a
>> broker for you in the current JVM, so that's why it's working in that
>> case.
>>
>> Best,
>> Ade
>>
>> On 9 Mar 2009, at 13:42, cmoulliard wrote:
>>
>>>
>>> Hi,
>>>
>>> Can someone tell me why I receive the following error :
>>>
>>> 2009-03-09 14:23:07,921 DEBUG TcpTransport - Stopping transport
>>> tcp://null:0
>>> 2009-03-09 14:23:07,921 DEBUG DefaultMessageListenerContainer -
>>> Could not
>>> establish shared JMS Connection - leaving it up to asynchronous
>>> invokers to
>>> establish a Connection as soon as possible
>>> javax.jms.JMSException: Could not connect to broker URL:
>>> tcp://localhost:61616. Reason: java.net.ConnectException: Connection
>>> refused: connect
>>>      at
>>> org
>>> .apache
>>> .activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .ActiveMQConnectionFactory
>>> .createActiveMQConnection(ActiveMQConnectionFactory.java:280)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .ActiveMQConnectionFactory
>>> .createActiveMQConnection(ActiveMQConnectionFactory.java:224)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .ActiveMQConnectionFactory
>>> .createConnection(ActiveMQConnectionFactory.java:172)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .pool
>>> .PooledConnectionFactory
>>> .createConnection(PooledConnectionFactory.java:125)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .pool
>>> .PooledConnectionFactory
>>> .createConnection(PooledConnectionFactory.java:110)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .pool
>>> .PooledConnectionFactory
>>> .createConnection(PooledConnectionFactory.java:81)
>>>      at
>>> org
>>> .springframework
>>> .jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .AbstractJmsListeningContainer
>>> .createSharedConnection(AbstractJmsListeningContainer.java:378)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .AbstractJmsListeningContainer
>>> .establishSharedConnection(AbstractJmsListeningContainer.java:346)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .DefaultMessageListenerContainer
>>> .establishSharedConnection(DefaultMessageListenerContainer.java:678)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .AbstractJmsListeningContainer
>>> .doStart(AbstractJmsListeningContainer.java:258)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .AbstractJmsListeningContainer
>>> .initialize(AbstractJmsListeningContainer.java:171)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .AbstractPollingMessageListenerContainer
>>> .initialize(AbstractPollingMessageListenerContainer.java:204)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .DefaultMessageListenerContainer
>>> .initialize(DefaultMessageListenerContainer.java:459)
>>>      at
>>> org
>>> .springframework
>>> .jms
>>> .listener
>>> .AbstractJmsListeningContainer
>>> .afterPropertiesSet(AbstractJmsListeningContainer.java:134)
>>>      at
>>> org.apache.camel.component.jms.JmsConsumer.doStart(JmsConsumer.java:
>>> 57)
>>>      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:50)
>>>      at
>>> org
>>> .apache.camel.impl.RouteService.startChildService(RouteService.java:
>>> 95)
>>>      at org.apache.camel.impl.RouteService.doStart(RouteService.java:79)
>>>      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:50)
>>>      at
>>> org
>>> .apache
>>> .camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:744)
>>>      at
>>> org
>>> .apache
>>> .camel
>>> .spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)
>>>      at
>>> org
>>> .apache
>>> .camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
>>>      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:50)
>>>      at
>>> org
>>> .apache
>>> .camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:
>>> 95)
>>>      at
>>> org
>>> .apache
>>> .camel
>>> .spring
>>> .SpringCamelContext.onApplicationEvent(SpringCamelContext.java:114)
>>>      at
>>> org.springframework.context.event.SimpleApplicationEventMulticaster
>>> $1.run(SimpleApplicationEventMulticaster.java:78)
>>>      at
>>> org
>>> .springframework
>>> .core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
>>>      at
>>> org
>>> .springframework
>>> .context
>>> .event
>>> .SimpleApplicationEventMulticaster
>>> .multicastEvent(SimpleApplicationEventMulticaster.java:76)
>>>      at
>>> org
>>> .springframework
>>> .context
>>> .support
>>> .AbstractApplicationContext
>>> .publishEvent(AbstractApplicationContext.java:274)
>>>      at
>>> org
>>> .springframework
>>> .context
>>> .support
>>> .AbstractApplicationContext
>>> .finishRefresh(AbstractApplicationContext.java:736)
>>>      at
>>> org
>>> .springframework
>>> .context
>>> .support
>>> .AbstractApplicationContext.refresh(AbstractApplicationContext.java:
>>> 383)
>>>      at
>>> org
>>> .springframework
>>> .context
>>> .support
>>> .ClassPathXmlApplicationContext
>>> .<init>(ClassPathXmlApplicationContext.java:139)
>>>      at
>>> org
>>> .springframework
>>> .context
>>> .support
>>> .ClassPathXmlApplicationContext
>>> .<init>(ClassPathXmlApplicationContext.java:93)
>>>      at
>>> org
>>> .apache.camel.spring.Main.createDefaultApplicationContext(Main.java:
>>> 232)
>>>      at org.apache.camel.spring.Main.doStart(Main.java:186)
>>>      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:50)
>>>      at org.apache.camel.util.MainSupport.run(MainSupport.java:121)
>>>      at org.apache.camel.util.MainSupport.run(MainSupport.java:299)
>>>      at org.apache.camel.spring.Main.main(Main.java:98)
>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>      at
>>> sun
>>> .reflect
>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>      at
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>      at java.lang.reflect.Method.invoke(Method.java:597)
>>>      at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:395)
>>>      at java.lang.Thread.run(Thread.java:619)
>>> Caused by: java.net.ConnectException: Connection refused: connect
>>>      at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>>>      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
>>> 195)
>>>      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>>>      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>>>      at java.net.Socket.connect(Socket.java:519)
>>>      at
>>> org
>>> .apache
>>> .activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:435)
>>>      at
>>> org
>>> .apache
>>> .activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:401)
>>>      at
>>> org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:53)
>>>      at
>>> org
>>> .apache
>>> .activemq.transport.TransportFilter.start(TransportFilter.java:57)
>>>      at
>>> org
>>> .apache
>>> .activemq.transport.TransportFilter.start(TransportFilter.java:57)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72)
>>>      at
>>> org
>>> .apache
>>> .activemq.transport.TransportFilter.start(TransportFilter.java:57)
>>>      at
>>> org
>>> .apache
>>> .activemq.transport.TransportFilter.start(TransportFilter.java:57)
>>>      at
>>> org
>>> .apache
>>> .activemq
>>> .ActiveMQConnectionFactory
>>> .createActiveMQConnection(ActiveMQConnectionFactory.java:260)
>>>      ... 45 more
>>>
>>> when I use the following syntax :
>>>
>>>      <bean id="activemq"
>>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>>              <property name="brokerURL" value="tcp://localhost:61616"
/>
>>>      </bean>
>>>
>>>
>>> Everything works fine when running with the parameter
>>> "vm://localhost:61616".
>>>
>>> Is it because ActiveMq must be started separately from Camel ? If
>>> this is
>>> case, it should be interesting to update documentation here :
>>> http://camel.apache.org/activemq.html to avoid confusion
>>>
>>> Regards,
>>>
>>>
>>>
>>>
>>>
>>> -----
>>> Charles Moulliard
>>> SOA Architect
>>>
>>> My Blog :  http://cmoulliard.blogspot.com/
>>> http://cmoulliard.blogspot.com/
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Camel-2.0---ActiveMq%3A-connection-refused-%28tcp%3A--localhost%3A61616%29-%21%21-tp22413400p22413400.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>> ---
>> Adrian Trenaman, Consultant Fellow, PS - Opensource Center of Competence
>> Progress Software Corp
>> Shelbourne Road, Dublin 4, Ireland
>> ---
>> +353-1-637-2659 (Office)
>> +353-1-637-2882 (Fax)
>> +353-86-6051026 (Mobile)
>>   adrian.trenaman (Skype)
>> ----
>> Blog: http://trenaman.blogspot.com
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Camel-2.0---ActiveMq%3A-connection-refused-%28tcp%3A--localhost%3A61616%29-%21%21-tp22413400p24690824.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message