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 <ming.li.e...@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_1x359xuukfkck0poohuvbwlqxt...@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_1x359xuukfkck0poohuvbwlqxt...@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-unsubscr...@qpid.apache.org > For additional commands, e-mail: dev-h...@qpid.apache.org > >