You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by beon2013 <mi...@gmail.com> on 2013/11/12 00:35:24 UTC

connection refused error for a Java EE app with RabbitMQ broker, Qpid JMS client

In my Java EE application, I want send and receive a message using a RabbitMQ
broker and a Qpid JMS client. 


The information about RabbitMQ broker is as follow:

Server: turtle.rmq.cloudamqp.com
User: tsikywzh
Password: Z_1x359XUuKfkcK0PoohUVBWlqXtxVh
AMQP URL:
amqp://tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh


The code for send a message using the Qpid JMS client:

public void sendMessage(){
        logger.log(Level.INFO, "Sending message {0}", messageText);
        Properties properties = new Properties();
   
properties.load(SenderBean.class.getResourceAsStream("/websimplemessage.properties"));
        Context context = new InitialContext(properties);
        ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("qpidConnectionfactory");
        Connection connection = connectionFactory.createConnection();
        connection.start();            
        Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
        Destination destination = (Destination)
context.lookup("topicExchange");
        MessageProducer messageProducer =
session.createProducer(destination);
        String text = "Message from producer: " + messageText;
        TextMessage message = session.createTextMessage(text);
        messageProducer.send(message);
        connection.close();
        context.close();
}
Which uses this Apache Qpid JNDI Properties File websimplemessage.properties
:

java.naming.factory.initial =
org.apache.qpid.jndi.PropertiesFileInitialContextFactory
connectionfactory.qpidConnectionfactory =
amqp://tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://localhost:5672'
destination.topicExchange = amq.topic

Unfortunately, when I run the application, I get connection errors:

SenderBean.sendMessage: Exception: javax.jms.JMSException: Error creating
connection: Connection refused

I am sure RabbitMQ broker is work. Maybe the Qpid JNDI properties File is
not correct.

How can I solve this error? Thanks



--
View this message in context: http://apache-qpid-developers.2158895.n2.nabble.com/connection-refused-error-for-a-Java-EE-app-with-RabbitMQ-broker-Qpid-JMS-client-tp7590925.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Re: connection refused error for a Java EE app with RabbitMQ broker, Qpid JMS client

Posted by Robbie Gemmell <ro...@gmail.com>.
The debug logging below suggests that the TCP connection may have been
severed by the broker once the client has sent its ConnectionTuneOk
response during the final steps of connection establishment. The best thing
might be to ask if the broker operator can tell you if there is indication
why it severed the connection. If I had to guess I would look at whether
the virtual host you are specifying (tsikywzh) actually exists and if you
have permission to access it.

Putting the above to one side I also noticed from your logging that you
still appear to be using Qpid 0.24, which as per my earlier email won't
work [once you succeed in getting it connected] against RabbitMQ. When you
try again, use either the nightly release I linked to or the 0.26 beta
which is now available: http://people.apache.org/~jross/qpid-0.26-beta/

Robbie

On 14 November 2013 14:41, beon2013 <mi...@gmail.com> wrote:

> Hi,
>
> Thanks for your response.
>
> Now, I have set my  Properties file as you said:
>
> java.naming.factory.initial =
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
> connectionfactory.qpidConnectionfactory =
> amqp://
> tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh8@turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://turtle.rmq.cloudamqp.com:5672
> '
> destination.topicExchange = amq.topic
>
> Now I got a new timeout error:
>
> INFO:   77   [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnection
> -
> Connection(1):amqp://tsikywzh:********@
> turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://turtle.rmq.cloudamqp.com:5672
> '
> INFO:   77   [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnection
> - AMQP version 0-10
> INFO:   635  [http-listener-1(3)] DEBUG
> org.apache.qpid.client.protocol.AMQProtocolSession  - Using ProtocolVersion
> for Session:0-10
> INFO:   683  [http-listener-1(3)] DEBUG
> org.apache.qpid.client.handler.ClientMethodDispatcherImpl  - New Method
> Dispatcher:AMQProtocolSession[null]
> INFO:   692  [http-listener-1(3)] DEBUG
> org.apache.qpid.framing.AMQMethodBodyFactory  - Creating content header
> body
> factory
> INFO:   693  [http-listener-1(3)] DEBUG
> org.apache.qpid.framing.AMQMethodBodyFactory  - Creating content body
> factory
> INFO:   696  [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnection
> - Connecting with ProtocolHandler Version:0-10
> INFO:   697  [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnectionDelegate_0_10  - connecting to host:
> turtle.rmq.cloudamqp.com port: 5672 vhost: tsikywzh username: tsikywzh
> password: ********
> INFO:   765  [http-listener-1(3)] DEBUG
> org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_RCVBUF :
> 65535
> INFO:   765  [http-listener-1(3)] DEBUG
> org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_SNDBUF :
> 65535
> INFO:   765  [http-listener-1(3)] DEBUG
> org.apache.qpid.transport.network.io.IoNetworkTransport  - TCP_NODELAY :
> true
> INFO:   1296 [http-listener-1(3)] DEBUG
> org.apache.qpid.transport.Connection
> - SEND: [conn:545c8113] AMQP.1 0-10
> INFO:   1407 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.transport.Connection  - RECV: [conn:545c8113] AMQP.0
> 9-1
> INFO:   1414 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.transport.Connection  - connection closed:
> conn:545c8113
> INFO:   1414 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnection
> - Looking up delegate 'org.apache.qpid.client.AMQConnectionDelegate_9_1'
> Based on PE:9-1
> INFO:   1419 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.protocol.AMQProtocolSession  - Setting
> ProtocolVersion to :0-91
> INFO:   1420 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.handler.ClientMethodDispatcherImpl  - New Method
> Dispatcher:AMQProtocolSession[AMQConnection:
> Host: turtle.rmq.cloudamqp.com
> Port: 5672
> Virtual Host: tsikywzh
> Client ID: turtle.rmq.cloudamqp.com
> Active session count: 0]
> INFO:   1420 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnectionDelegate_8_0  - Connecting to
> broker:tcp://turtle.rmq.cloudamqp.com:5672
> INFO:   1420 [http-listener-1(3)] DEBUG
> org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_RCVBUF :
> 65535
> INFO:   1420 [http-listener-1(3)] DEBUG
> org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_SNDBUF :
> 65535
> INFO:   1421 [http-listener-1(3)] DEBUG
> org.apache.qpid.transport.network.io.IoNetworkTransport  - TCP_NODELAY :
> true
> INFO:   1536 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.state.StateWaiter  - New StateWaiter :AMQState: id =
> 1 name: CONNECTION_NOT_STARTED:[AMQState: id = 4 name: CONNECTION_OPEN,
> AMQState: id = 6 name: CONNECTION_CLOSED]
> INFO:   1542 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.protocol.AMQProtocolHandler  - Sent 1 protocol
> messages
> INFO:   1676 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  -
> (1683129267)Method frame received: [ConnectionStartBodyImpl:
> versionMajor=0,
> versionMinor=9, serverProperties={capabilities=[FIELD_TABLE:
> {publisher_confirms=[BOOLEAN: true], exchange_exchange_bindings=[BOOLEAN:
> true], basic.nack=[BOOLEAN: true], consumer_cancel_notify=[BOOLEAN:
> true]}],
> copyright=[LONG_STRING: Copyright (C) 2007-2013 GoPivotal, Inc.],
> information=[LONG_STRING: Licensed under the MPL.  See
> http://www.rabbitmq.com/], platform=[LONG_STRING: Erlang/OTP],
> product=[LONG_STRING: RabbitMQ], version=[LONG_STRING: 3.1.5]},
> mechanisms=[65, 77, 81, 80, 76, 65, 73, 78, 32, 80, 76, 65, 73, 78],
> locales=[101, 110, 95, 85, 83]]
> INFO:   1678 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.handler.ConnectionStartMethodHandler  - public
> void methodReceived(AMQStateManager stateManager, AMQProtocolSession
> protocolSession, AMQMethodEvent evt): called
> INFO:   1678 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.protocol.AMQProtocolSession  - Setting
> ProtocolVersion to :0-91
> INFO:   1678 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.handler.ClientMethodDispatcherImpl  - New
> Method Dispatcher:AMQProtocolSession[AMQConnection:
> Host: turtle.rmq.cloudamqp.com
> Port: 5672
> Virtual Host: tsikywzh
> Client ID: turtle.rmq.cloudamqp.com
> Active session count: 0]
> INFO:   1682 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - public static
> void registerSaslProviders(): called
> INFO:   1685 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - props =
>
> {ANONYMOUS=org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory,
>
> CRAM-MD5-HASHED=org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory,
>
> AMQPLAIN=org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory}
> INFO:   1687 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Found class
> org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory for
> mechanism ANONYMOUS
> INFO:   1688 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Found class
>
> org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory
> for mechanism CRAM-MD5-HASHED
> INFO:   1688 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Found class
> org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory for
> mechanism AMQPLAIN
> INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.JCAProvider  - Recording SASL Client
> factory for AMQPLAIN as
> org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory
> INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.JCAProvider  - Recording SASL Client
> factory for ANONYMOUS as
> org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory
> INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.JCAProvider  - Recording SASL Client
> factory for CRAM-MD5-HASHED as
>
> org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory
> INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Custom SASL
> provider is already registered with equal properties.
> INFO:   1693 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> INFO  org.apache.qpid.client.security.CallbackHandlerRegistry  - Callback
> handlers available for SASL mechanisms: [EXTERNAL, GSSAPI, CRAM-MD5-HASHED,
> CRAM-MD5, AMQPLAIN, PLAIN, ANONYMOUS]
> INFO:   1693 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.handler.ConnectionStartMethodHandler  -
> mechanism = AMQPLAIN
> INFO:   1694 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.state.AMQStateManager  - State changing to
> AMQState: id = 2 name: CONNECTION_NOT_TUNED from old state AMQState: id = 1
> name: CONNECTION_NOT_STARTED
> INFO:   1694 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.state.AMQStateManager  - Notififying State
> change to 1 : [org.apache.qpid.client.state.StateWaiter@1bcad6e1]
> INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.common.QpidProperties  - Dumping QpidProperties
> INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.common.QpidProperties  - Property: qpid.version
> Value:
> 0.24
> INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.common.QpidProperties  - Property: qpid.svnversion
> Value: 1516979
> INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.common.QpidProperties  - Property: qpid.name Value:
> qpid
> INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.common.QpidProperties  - End of property dump
> INFO:   1698 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.framing.FieldTable  - FieldTable::writeToBuffer:
> Writing encoded length of 248...
> INFO:   1698 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.framing.FieldTable  - {instance=[LONG_STRING:
> turtle.rmq.cloudamqp.com], product=[LONG_STRING: qpid],
> version=[LONG_STRING: 0.24], platform=[LONG_STRING: Java(TM) SE Runtime
> Environment, 1.7.0_40-b43, Oracle Corporation, x86_64, Mac OS X, 10.8.5,
> unknown], qpid.client_process=[LONG_STRING: Qpid Java Client],
> qpid.client_pid=[INT: 611]}
> INFO:   1817 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  -
> (1683129267)Method frame received: [ConnectionTuneBodyImpl: channelMax=0,
> frameMax=131072, heartbeat=600]
> INFO:   1817 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.handler.ConnectionTuneMethodHandler  -
> ConnectionTune frame received
> INFO:   1820 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.state.AMQStateManager  - State changing to
> AMQState: id = 3 name: CONNECTION_NOT_OPENED from old state AMQState: id =
> 2
> name: CONNECTION_NOT_TUNED
> INFO:   1820 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.state.AMQStateManager  - Notififying State
> change to 1 : [org.apache.qpid.client.state.StateWaiter@1bcad6e1]
> INFO:   4992 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> INFO  org.apache.qpid.client.protocol.AMQProtocolHandler  - Connection
> exception caught therefore going to attempt failover:
> java.net.SocketException: Connection reset
> java.net.SocketException: Connection reset
>         at java.net.SocketInputStream.read(SocketInputStream.java:196)
>         at java.net.SocketInputStream.read(SocketInputStream.java:122)
>         at
> org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:156)
>         at java.lang.Thread.run(Thread.java:724)
> INFO:   4994 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  - Session closed
> called with failover state FailoverState: NOT STARTED
> INFO:   4994 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  - We are in
> process of establishing the initial connection
> INFO:   4994 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
> DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  - Protocol
> Session
> [org.apache.qpid.client.protocol.AMQProtocolHandler@645283b3] closed
> INFO:   31544 [http-listener-1(3)] INFO
> org.apache.qpid.client.AMQConnection  - Unable to connect to broker at
> tcp://turtle.rmq.cloudamqp.com:5672
> org.apache.qpid.AMQTimeoutException: Server did not respond in a timely
> fashion [error code 408: Request Timeout]
>         at
> org.apache.qpid.client.util.BlockingWaiter.block(BlockingWaiter.java:177)
>         at
> org.apache.qpid.client.state.StateWaiter.await(StateWaiter.java:114)
>         at
> org.apache.qpid.client.state.StateWaiter.await(StateWaiter.java:91)
>         at
>
> org.apache.qpid.client.AMQConnectionDelegate_8_0.makeBrokerConnection(AMQConnectionDelegate_8_0.java:135)
>         at
>
> org.apache.qpid.client.AMQConnection.makeBrokerConnection(AMQConnection.java:619)
>         at
> org.apache.qpid.client.AMQConnection.<init>(AMQConnection.java:398)
>         at
>
> org.apache.qpid.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:121)
>         at
> javaeetutorial.websimplemessage.SenderBean.sendMessage(SenderBean.java:68)
>         at
>
> org.jboss.weldeetutorial.websimplemessage.SenderBean$Proxy$_$$_WeldClientProxy.sendMessage(Unknown
> Source)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at com.sun.el.parser.AstValue.invoke(AstValue.java:275)
>         at
> com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
>         at
>
> org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
>         at
> org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
>         at
>
> com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
>         at
>
> javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
>         at
>
> com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
>         at javax.faces.component.UICommand.broadcast(UICommand.java:315)
>         at
> javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
>         at
> javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
>         at
>
> com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
>         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
>         at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
>         at
> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
>         at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
>         at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
>         at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
>         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
>         at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
>         at
>
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
>         at
>
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
>         at
>
> org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
>         at
>
> org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
>         at
>
> org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
>         at
>
> org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
>         at
>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
>         at
>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
>         at
>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
>         at
>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
>         at
> org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
>         at
>
> org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
>         at
>
> org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
>         at
>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
>         at
>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
>         at
>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
>         at
>
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
>         at
>
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
>         at java.lang.Thread.run(Thread.java:724)
> INFO:   31546 [http-listener-1(3)] DEBUG org.apache.qpid.jms.FailoverPolicy
> - All failover methods exhausted
> ERROR:   SenderBean.sendMessage: Exception: javax.jms.JMSException: Error
> creating connection: Server did not respond in a timely fashion
> INFO:   31546 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnection  - Are we connected:false
> INFO:   31546 [http-listener-1(3)] DEBUG
> org.apache.qpid.client.AMQConnection  - Last attempted ProtocolHandler
> Version:0-91
>
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/connection-refused-error-for-a-Java-EE-app-with-RabbitMQ-broker-Qpid-JMS-client-tp7600694p7600757.html
> Sent from the Apache Qpid developers mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>
>

Re: connection refused error for a Java EE app with RabbitMQ broker, Qpid JMS client

Posted by beon2013 <mi...@gmail.com>.
Hi, 

Thanks for your response. 

Now, I have set my  Properties file as you said:

java.naming.factory.initial =
org.apache.qpid.jndi.PropertiesFileInitialContextFactory
connectionfactory.qpidConnectionfactory =
amqp://tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh8@turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://turtle.rmq.cloudamqp.com:5672'
destination.topicExchange = amq.topic

Now I got a new timeout error:

INFO:   77   [http-listener-1(3)] DEBUG org.apache.qpid.client.AMQConnection 
-
Connection(1):amqp://tsikywzh:********@turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://turtle.rmq.cloudamqp.com:5672'
INFO:   77   [http-listener-1(3)] DEBUG org.apache.qpid.client.AMQConnection 
- AMQP version 0-10
INFO:   635  [http-listener-1(3)] DEBUG
org.apache.qpid.client.protocol.AMQProtocolSession  - Using ProtocolVersion
for Session:0-10
INFO:   683  [http-listener-1(3)] DEBUG
org.apache.qpid.client.handler.ClientMethodDispatcherImpl  - New Method
Dispatcher:AMQProtocolSession[null]
INFO:   692  [http-listener-1(3)] DEBUG
org.apache.qpid.framing.AMQMethodBodyFactory  - Creating content header body
factory
INFO:   693  [http-listener-1(3)] DEBUG
org.apache.qpid.framing.AMQMethodBodyFactory  - Creating content body
factory
INFO:   696  [http-listener-1(3)] DEBUG org.apache.qpid.client.AMQConnection 
- Connecting with ProtocolHandler Version:0-10
INFO:   697  [http-listener-1(3)] DEBUG
org.apache.qpid.client.AMQConnectionDelegate_0_10  - connecting to host:
turtle.rmq.cloudamqp.com port: 5672 vhost: tsikywzh username: tsikywzh
password: ********
INFO:   765  [http-listener-1(3)] DEBUG
org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_RCVBUF : 65535
INFO:   765  [http-listener-1(3)] DEBUG
org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_SNDBUF : 65535
INFO:   765  [http-listener-1(3)] DEBUG
org.apache.qpid.transport.network.io.IoNetworkTransport  - TCP_NODELAY :
true
INFO:   1296 [http-listener-1(3)] DEBUG org.apache.qpid.transport.Connection 
- SEND: [conn:545c8113] AMQP.1 0-10
INFO:   1407 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.transport.Connection  - RECV: [conn:545c8113] AMQP.0
9-1
INFO:   1414 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.transport.Connection  - connection closed:
conn:545c8113
INFO:   1414 [http-listener-1(3)] DEBUG org.apache.qpid.client.AMQConnection 
- Looking up delegate 'org.apache.qpid.client.AMQConnectionDelegate_9_1'
Based on PE:9-1
INFO:   1419 [http-listener-1(3)] DEBUG
org.apache.qpid.client.protocol.AMQProtocolSession  - Setting
ProtocolVersion to :0-91
INFO:   1420 [http-listener-1(3)] DEBUG
org.apache.qpid.client.handler.ClientMethodDispatcherImpl  - New Method
Dispatcher:AMQProtocolSession[AMQConnection:
Host: turtle.rmq.cloudamqp.com
Port: 5672
Virtual Host: tsikywzh
Client ID: turtle.rmq.cloudamqp.com
Active session count: 0]
INFO:   1420 [http-listener-1(3)] DEBUG
org.apache.qpid.client.AMQConnectionDelegate_8_0  - Connecting to
broker:tcp://turtle.rmq.cloudamqp.com:5672
INFO:   1420 [http-listener-1(3)] DEBUG
org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_RCVBUF : 65535
INFO:   1420 [http-listener-1(3)] DEBUG
org.apache.qpid.transport.network.io.IoNetworkTransport  - SO_SNDBUF : 65535
INFO:   1421 [http-listener-1(3)] DEBUG
org.apache.qpid.transport.network.io.IoNetworkTransport  - TCP_NODELAY :
true
INFO:   1536 [http-listener-1(3)] DEBUG
org.apache.qpid.client.state.StateWaiter  - New StateWaiter :AMQState: id =
1 name: CONNECTION_NOT_STARTED:[AMQState: id = 4 name: CONNECTION_OPEN,
AMQState: id = 6 name: CONNECTION_CLOSED]
INFO:   1542 [http-listener-1(3)] DEBUG
org.apache.qpid.client.protocol.AMQProtocolHandler  - Sent 1 protocol
messages
INFO:   1676 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  -
(1683129267)Method frame received: [ConnectionStartBodyImpl: versionMajor=0,
versionMinor=9, serverProperties={capabilities=[FIELD_TABLE:
{publisher_confirms=[BOOLEAN: true], exchange_exchange_bindings=[BOOLEAN:
true], basic.nack=[BOOLEAN: true], consumer_cancel_notify=[BOOLEAN: true]}],
copyright=[LONG_STRING: Copyright (C) 2007-2013 GoPivotal, Inc.],
information=[LONG_STRING: Licensed under the MPL.  See
http://www.rabbitmq.com/], platform=[LONG_STRING: Erlang/OTP],
product=[LONG_STRING: RabbitMQ], version=[LONG_STRING: 3.1.5]},
mechanisms=[65, 77, 81, 80, 76, 65, 73, 78, 32, 80, 76, 65, 73, 78],
locales=[101, 110, 95, 85, 83]]
INFO:   1678 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.handler.ConnectionStartMethodHandler  - public
void methodReceived(AMQStateManager stateManager, AMQProtocolSession
protocolSession, AMQMethodEvent evt): called
INFO:   1678 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.protocol.AMQProtocolSession  - Setting
ProtocolVersion to :0-91
INFO:   1678 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.handler.ClientMethodDispatcherImpl  - New
Method Dispatcher:AMQProtocolSession[AMQConnection:
Host: turtle.rmq.cloudamqp.com
Port: 5672
Virtual Host: tsikywzh
Client ID: turtle.rmq.cloudamqp.com
Active session count: 0]
INFO:   1682 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - public static
void registerSaslProviders(): called
INFO:   1685 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - props =
{ANONYMOUS=org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory,
CRAM-MD5-HASHED=org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory,
AMQPLAIN=org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory}
INFO:   1687 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Found class
org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory for
mechanism ANONYMOUS
INFO:   1688 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Found class
org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory
for mechanism CRAM-MD5-HASHED
INFO:   1688 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Found class
org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory for
mechanism AMQPLAIN
INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.JCAProvider  - Recording SASL Client
factory for AMQPLAIN as
org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory
INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.JCAProvider  - Recording SASL Client
factory for ANONYMOUS as
org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory
INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.JCAProvider  - Recording SASL Client
factory for CRAM-MD5-HASHED as
org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory
INFO:   1689 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.security.DynamicSaslRegistrar  - Custom SASL
provider is already registered with equal properties.
INFO:   1693 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
INFO  org.apache.qpid.client.security.CallbackHandlerRegistry  - Callback
handlers available for SASL mechanisms: [EXTERNAL, GSSAPI, CRAM-MD5-HASHED,
CRAM-MD5, AMQPLAIN, PLAIN, ANONYMOUS]
INFO:   1693 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.handler.ConnectionStartMethodHandler  -
mechanism = AMQPLAIN
INFO:   1694 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.state.AMQStateManager  - State changing to
AMQState: id = 2 name: CONNECTION_NOT_TUNED from old state AMQState: id = 1
name: CONNECTION_NOT_STARTED
INFO:   1694 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.state.AMQStateManager  - Notififying State
change to 1 : [org.apache.qpid.client.state.StateWaiter@1bcad6e1]
INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.common.QpidProperties  - Dumping QpidProperties
INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.common.QpidProperties  - Property: qpid.version Value:
0.24
INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.common.QpidProperties  - Property: qpid.svnversion
Value: 1516979
INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.common.QpidProperties  - Property: qpid.name Value:
qpid
INFO:   1696 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.common.QpidProperties  - End of property dump
INFO:   1698 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.framing.FieldTable  - FieldTable::writeToBuffer:
Writing encoded length of 248...
INFO:   1698 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.framing.FieldTable  - {instance=[LONG_STRING:
turtle.rmq.cloudamqp.com], product=[LONG_STRING: qpid],
version=[LONG_STRING: 0.24], platform=[LONG_STRING: Java(TM) SE Runtime
Environment, 1.7.0_40-b43, Oracle Corporation, x86_64, Mac OS X, 10.8.5,
unknown], qpid.client_process=[LONG_STRING: Qpid Java Client],
qpid.client_pid=[INT: 611]}
INFO:   1817 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  -
(1683129267)Method frame received: [ConnectionTuneBodyImpl: channelMax=0,
frameMax=131072, heartbeat=600]
INFO:   1817 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.handler.ConnectionTuneMethodHandler  -
ConnectionTune frame received
INFO:   1820 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.state.AMQStateManager  - State changing to
AMQState: id = 3 name: CONNECTION_NOT_OPENED from old state AMQState: id = 2
name: CONNECTION_NOT_TUNED
INFO:   1820 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.state.AMQStateManager  - Notififying State
change to 1 : [org.apache.qpid.client.state.StateWaiter@1bcad6e1]
INFO:   4992 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
INFO  org.apache.qpid.client.protocol.AMQProtocolHandler  - Connection
exception caught therefore going to attempt failover:
java.net.SocketException: Connection reset
java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:196)
	at java.net.SocketInputStream.read(SocketInputStream.java:122)
	at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:156)
	at java.lang.Thread.run(Thread.java:724)
INFO:   4994 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  - Session closed
called with failover state FailoverState: NOT STARTED
INFO:   4994 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  - We are in
process of establishing the initial connection
INFO:   4994 [IoReceiver - turtle.rmq.cloudamqp.com/184.72.161.238:5672]
DEBUG org.apache.qpid.client.protocol.AMQProtocolHandler  - Protocol Session
[org.apache.qpid.client.protocol.AMQProtocolHandler@645283b3] closed
INFO:   31544 [http-listener-1(3)] INFO 
org.apache.qpid.client.AMQConnection  - Unable to connect to broker at
tcp://turtle.rmq.cloudamqp.com:5672
org.apache.qpid.AMQTimeoutException: Server did not respond in a timely
fashion [error code 408: Request Timeout]
	at
org.apache.qpid.client.util.BlockingWaiter.block(BlockingWaiter.java:177)
	at org.apache.qpid.client.state.StateWaiter.await(StateWaiter.java:114)
	at org.apache.qpid.client.state.StateWaiter.await(StateWaiter.java:91)
	at
org.apache.qpid.client.AMQConnectionDelegate_8_0.makeBrokerConnection(AMQConnectionDelegate_8_0.java:135)
	at
org.apache.qpid.client.AMQConnection.makeBrokerConnection(AMQConnection.java:619)
	at org.apache.qpid.client.AMQConnection.<init>(AMQConnection.java:398)
	at
org.apache.qpid.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:121)
	at
javaeetutorial.websimplemessage.SenderBean.sendMessage(SenderBean.java:68)
	at
org.jboss.weldeetutorial.websimplemessage.SenderBean$Proxy$_$$_WeldClientProxy.sendMessage(Unknown
Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.sun.el.parser.AstValue.invoke(AstValue.java:275)
	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
	at
org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
	at
org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
	at
com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
	at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
	at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
	at javax.faces.component.UICommand.broadcast(UICommand.java:315)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
	at
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
	at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
	at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
	at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
	at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
	at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
	at
org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
	at
org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
	at
org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
	at
org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
	at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
	at
org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
	at
org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
	at
org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at
org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
	at
org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
	at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
	at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
	at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
	at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
	at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
	at java.lang.Thread.run(Thread.java:724)
INFO:   31546 [http-listener-1(3)] DEBUG org.apache.qpid.jms.FailoverPolicy 
- All failover methods exhausted
ERROR:   SenderBean.sendMessage: Exception: javax.jms.JMSException: Error
creating connection: Server did not respond in a timely fashion
INFO:   31546 [http-listener-1(3)] DEBUG
org.apache.qpid.client.AMQConnection  - Are we connected:false
INFO:   31546 [http-listener-1(3)] DEBUG
org.apache.qpid.client.AMQConnection  - Last attempted ProtocolHandler
Version:0-91




--
View this message in context: http://qpid.2158936.n2.nabble.com/connection-refused-error-for-a-Java-EE-app-with-RabbitMQ-broker-Qpid-JMS-client-tp7600694p7600757.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Re: connection refused error for a Java EE app with RabbitMQ broker, Qpid JMS client

Posted by Oleksandr Rudyy <or...@gmail.com>.
Hi,

Your specified a broker host as localhost in your connection URL.
I suppose that your client application is not located on the same host
as broker. Thus, the connection cannot be established and error is
reported.
You can replace the locahost with turtle.rmq.cloudamqp.com in your
connection URL and try again.

Please, have a look at [1] for more details about Qpid connection URL format.

Kind Regards,
Alex

[1] http://qpid.apache.org/releases/qpid-0.24/programming/book/QpidJNDI.html

On 11 November 2013 23:35, beon2013 <mi...@gmail.com> wrote:
> In my Java EE application, I want send and receive a message using a RabbitMQ
> broker and a Qpid JMS client.
>
>
> The information about RabbitMQ broker is as follow:
>
> Server: turtle.rmq.cloudamqp.com
> User: tsikywzh
> Password: Z_1x359XUuKfkcK0PoohUVBWlqXtxVh
> AMQP URL:
> amqp://tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh
>
>
> The code for send a message using the Qpid JMS client:
>
> public void sendMessage(){
>         logger.log(Level.INFO, "Sending message {0}", messageText);
>         Properties properties = new Properties();
>
> properties.load(SenderBean.class.getResourceAsStream("/websimplemessage.properties"));
>         Context context = new InitialContext(properties);
>         ConnectionFactory connectionFactory = (ConnectionFactory)
> context.lookup("qpidConnectionfactory");
>         Connection connection = connectionFactory.createConnection();
>         connection.start();
>         Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>         Destination destination = (Destination)
> context.lookup("topicExchange");
>         MessageProducer messageProducer =
> session.createProducer(destination);
>         String text = "Message from producer: " + messageText;
>         TextMessage message = session.createTextMessage(text);
>         messageProducer.send(message);
>         connection.close();
>         context.close();
> }
> Which uses this Apache Qpid JNDI Properties File websimplemessage.properties
> :
>
> java.naming.factory.initial =
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
> connectionfactory.qpidConnectionfactory =
> amqp://tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://localhost:5672'
> destination.topicExchange = amq.topic
>
> Unfortunately, when I run the application, I get connection errors:
>
> SenderBean.sendMessage: Exception: javax.jms.JMSException: Error creating
> connection: Connection refused
>
> I am sure RabbitMQ broker is work. Maybe the Qpid JNDI properties File is
> not correct.
>
> How can I solve this error? Thanks
>
>
>
> --
> View this message in context: http://apache-qpid-developers.2158895.n2.nabble.com/connection-refused-error-for-a-Java-EE-app-with-RabbitMQ-broker-Qpid-JMS-client-tp7590925.html
> Sent from the Apache Qpid developers mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Re: connection refused error for a Java EE app with RabbitMQ broker, Qpid JMS client

Posted by Robbie Gemmell <ro...@gmail.com>.
"or prefix the values of your 'destination.<lookup_name>' entries with BURL
(i.e destination.<lookupname>=BURL.value"

To correct myself, that should have been BURL: and then
destination.<lookupname>=BURL:value

Robbie


On 12 November 2013 22:56, Robbie Gemmell <ro...@gmail.com> wrote:

> As Alex has already beaten me to saying, the problem looks to be that the
> connection url you are using is rather malformed and is instructing the
> Qpid client to [attempt to] connect to your own machine.
>
> You can find documentation of the actual connection url format used by the
> client at:
>
> http://qpid.apache.org/releases/qpid-0.24/programming/book/QpidJNDI.html#section-jms-connection-url
>
> If you get that working, you will then likely discover a new issue in that
> the destination syntax the client will use based on your properties file is
> not actually supported when connecting to an AMQP 0-9-1 broker [such as
> RabbitMQ]. The solution to this is either to set the system property
> qpid.dest_syntax to BURL (i.e -Dqpid.dest_syntax=BURL) on your client
> application, or prefix the values of your 'destination.<lookup_name>'
> entries with BURL (i.e destination.<lookupname>=BURL.value), and then
> ensure that the 'destination.' entry value uses the BindingURL format
> outlined at
> https://cwiki.apache.org/confluence/display/qpid/BindingURLFormat.
> Alternatively, you can instead use the simpler 'queue.' and 'topic.'
> entries:
>
> # queue.[jndiName] = [physicalName]
> queue.myQueue = myQueue
>
> # topic.[jndiName] = [physicalName]
> topic.myTopic= a.b.c
>
> Next, if you are trying a recent Qpid release and a recent RabbitMQ
> release together, you will likely then run into
> https://issues.apache.org/jira/browse/QPID-5224 and
> https://issues.apache.org/jira/browse/QPID-5184, plus potentially
> https://issues.apache.org/jira/browse/QPID-5223. That is to say, you'll
> iehter need to use older versions of Qpid and RabbitMQ, or will need to use
> the current trunk version of the client (which was just branched 30mins ago
> to form the basis of the 0.26 release due in a few weeks). You can get a
> nightly build archive from:
> https://builds.apache.org/view/M-R/view/Qpid/job/Qpid-Java-Artefact-Release/lastSuccessfulBuild/artifact/trunk/qpid/java/client/release/or alternatively use the ASF snapshots repo:
> https://repository.apache.org/content/repositories/snapshots/
>
> Finally, you also almost certainly want to change the user details you
> have posted to the mailing list.
>
> Regards,
> Robbie
>
>
> On 11 November 2013 23:35, beon2013 <mi...@gmail.com> wrote:
>
>> In my Java EE application, I want send and receive a message using a
>> RabbitMQ
>> broker and a Qpid JMS client.
>>
>>
>> The information about RabbitMQ broker is as follow:
>>
>> Server: turtle.rmq.cloudamqp.com
>> User: tsikywzh
>> Password: Z_1x359XUuKfkcK0PoohUVBWlqXtxVh
>> AMQP URL:
>> amqp://
>> tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh
>>
>>
>> The code for send a message using the Qpid JMS client:
>>
>> public void sendMessage(){
>>         logger.log(Level.INFO, "Sending message {0}", messageText);
>>         Properties properties = new Properties();
>>
>>
>> properties.load(SenderBean.class.getResourceAsStream("/websimplemessage.properties"));
>>         Context context = new InitialContext(properties);
>>         ConnectionFactory connectionFactory = (ConnectionFactory)
>> context.lookup("qpidConnectionfactory");
>>         Connection connection = connectionFactory.createConnection();
>>         connection.start();
>>         Session session = connection.createSession(false,
>> Session.AUTO_ACKNOWLEDGE);
>>         Destination destination = (Destination)
>> context.lookup("topicExchange");
>>         MessageProducer messageProducer =
>> session.createProducer(destination);
>>         String text = "Message from producer: " + messageText;
>>         TextMessage message = session.createTextMessage(text);
>>         messageProducer.send(message);
>>         connection.close();
>>         context.close();
>> }
>> Which uses this Apache Qpid JNDI Properties File
>> websimplemessage.properties
>> :
>>
>> java.naming.factory.initial =
>> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
>> connectionfactory.qpidConnectionfactory =
>> amqp://
>> tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://localhost:5672
>> '
>> destination.topicExchange = amq.topic
>>
>> Unfortunately, when I run the application, I get connection errors:
>>
>> SenderBean.sendMessage: Exception: javax.jms.JMSException: Error creating
>> connection: Connection refused
>>
>> I am sure RabbitMQ broker is work. Maybe the Qpid JNDI properties File is
>> not correct.
>>
>> How can I solve this error? Thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-qpid-developers.2158895.n2.nabble.com/connection-refused-error-for-a-Java-EE-app-with-RabbitMQ-broker-Qpid-JMS-client-tp7590925.html
>> Sent from the Apache Qpid developers mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: dev-help@qpid.apache.org
>>
>>
>

Re: connection refused error for a Java EE app with RabbitMQ broker, Qpid JMS client

Posted by Robbie Gemmell <ro...@gmail.com>.
As Alex has already beaten me to saying, the problem looks to be that the
connection url you are using is rather malformed and is instructing the
Qpid client to [attempt to] connect to your own machine.

You can find documentation of the actual connection url format used by the
client at:
http://qpid.apache.org/releases/qpid-0.24/programming/book/QpidJNDI.html#section-jms-connection-url

If you get that working, you will then likely discover a new issue in that
the destination syntax the client will use based on your properties file is
not actually supported when connecting to an AMQP 0-9-1 broker [such as
RabbitMQ]. The solution to this is either to set the system property
qpid.dest_syntax to BURL (i.e -Dqpid.dest_syntax=BURL) on your client
application, or prefix the values of your 'destination.<lookup_name>'
entries with BURL (i.e destination.<lookupname>=BURL.value), and then
ensure that the 'destination.' entry value uses the BindingURL format
outlined at
https://cwiki.apache.org/confluence/display/qpid/BindingURLFormat.
Alternatively, you can instead use the simpler 'queue.' and 'topic.'
entries:

# queue.[jndiName] = [physicalName]
queue.myQueue = myQueue

# topic.[jndiName] = [physicalName]
topic.myTopic= a.b.c

Next, if you are trying a recent Qpid release and a recent RabbitMQ release
together, you will likely then run into
https://issues.apache.org/jira/browse/QPID-5224 and
https://issues.apache.org/jira/browse/QPID-5184, plus potentially
https://issues.apache.org/jira/browse/QPID-5223. That is to say, you'll
iehter need to use older versions of Qpid and RabbitMQ, or will need to use
the current trunk version of the client (which was just branched 30mins ago
to form the basis of the 0.26 release due in a few weeks). You can get a
nightly build archive from:
https://builds.apache.org/view/M-R/view/Qpid/job/Qpid-Java-Artefact-Release/lastSuccessfulBuild/artifact/trunk/qpid/java/client/release/or
alternatively use the ASF snapshots repo:
https://repository.apache.org/content/repositories/snapshots/

Finally, you also almost certainly want to change the user details you have
posted to the mailing list.

Regards,
Robbie


On 11 November 2013 23:35, beon2013 <mi...@gmail.com> wrote:

> In my Java EE application, I want send and receive a message using a
> RabbitMQ
> broker and a Qpid JMS client.
>
>
> The information about RabbitMQ broker is as follow:
>
> Server: turtle.rmq.cloudamqp.com
> User: tsikywzh
> Password: Z_1x359XUuKfkcK0PoohUVBWlqXtxVh
> AMQP URL:
> amqp://
> tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh
>
>
> The code for send a message using the Qpid JMS client:
>
> public void sendMessage(){
>         logger.log(Level.INFO, "Sending message {0}", messageText);
>         Properties properties = new Properties();
>
>
> properties.load(SenderBean.class.getResourceAsStream("/websimplemessage.properties"));
>         Context context = new InitialContext(properties);
>         ConnectionFactory connectionFactory = (ConnectionFactory)
> context.lookup("qpidConnectionfactory");
>         Connection connection = connectionFactory.createConnection();
>         connection.start();
>         Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>         Destination destination = (Destination)
> context.lookup("topicExchange");
>         MessageProducer messageProducer =
> session.createProducer(destination);
>         String text = "Message from producer: " + messageText;
>         TextMessage message = session.createTextMessage(text);
>         messageProducer.send(message);
>         connection.close();
>         context.close();
> }
> Which uses this Apache Qpid JNDI Properties File
> websimplemessage.properties
> :
>
> java.naming.factory.initial =
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
> connectionfactory.qpidConnectionfactory =
> amqp://
> tsikywzh:Z_1x359XUuKfkcK0PoohUVBWlqXtxVh@turtle.rmq.cloudamqp.com/tsikywzh?brokerlist='tcp://localhost:5672
> '
> destination.topicExchange = amq.topic
>
> Unfortunately, when I run the application, I get connection errors:
>
> SenderBean.sendMessage: Exception: javax.jms.JMSException: Error creating
> connection: Connection refused
>
> I am sure RabbitMQ broker is work. Maybe the Qpid JNDI properties File is
> not correct.
>
> How can I solve this error? Thanks
>
>
>
> --
> View this message in context:
> http://apache-qpid-developers.2158895.n2.nabble.com/connection-refused-error-for-a-Java-EE-app-with-RabbitMQ-broker-Qpid-JMS-client-tp7590925.html
> Sent from the Apache Qpid developers mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>
>