Hello, I am trying to use jms(jboss-messaging-1.4.0.SP3). When I started my application I have this problem : Exception in thread "main" org.jboss.jms.exception.MessagingNetworkFailureException
This problem arrived when I execut this code : conn = qcf.createQueueConnection(); All application cod: | | import javax.jms.JMSException; | import javax.jms.Message; | import javax.jms.MessageListener; | import javax.jms.Queue; | import javax.jms.QueueConnection; | import javax.jms.QueueConnectionFactory; | import javax.jms.QueueReceiver; | import javax.jms.QueueSender; | import javax.jms.QueueSession; | import javax.jms.TextMessage; | import javax.naming.InitialContext; | import javax.naming.NamingException; | | import EDU.oswego.cs.dl.util.concurrent.CountDown; | import org.apache.log4j.Logger; | | /** | * A complete JMS client example program that sends a | * TextMessage to a Queue and asynchronously receives the | * message from the same Queue. | * | * @author [email protected] | * @version $Revision: 1.2 $ | */ | public class SendRecvClient | { | static CountDown done = new CountDown(1); | QueueConnection conn; | QueueSession session; | Queue que; | | public static class ExListener | implements MessageListener | { | public void onMessage(Message msg) | { | done.release(); | TextMessage tm = (TextMessage) msg; | try { | System.out.println("onMessage, recv text=" + tm.getText()); | } catch(Throwable t) { | t.printStackTrace(); | } | } | } | | public void setupPTP() | throws JMSException, | NamingException | { | InitialContext iniCtx = new InitialContext(); | Object tmp = iniCtx.lookup("ConnectionFactory"); | QueueConnectionFactory qcf = (QueueConnectionFactory) tmp; | conn = qcf.createQueueConnection(); | que = (Queue) iniCtx.lookup("queue/DLQ"); | session = conn.createQueueSession(false, | QueueSession.AUTO_ACKNOWLEDGE); | conn.start(); | } | | public void sendRecvAsync(String text) | throws JMSException, | NamingException | { | System.out.println("Begin sendRecvAsync"); | // Setup the PTP connection, session | setupPTP(); | | // Set the async listener | QueueReceiver recv = session.createReceiver(que); | recv.setMessageListener(new ExListener()); | | // Send a text msg | QueueSender send = session.createSender(que); | TextMessage tm = session.createTextMessage(text); | send.send(tm); | System.out.println("sendRecvAsync, sent text=" + tm.getText()); | send.close(); | System.out.println("End sendRecvAsync"); | } | | public void stop() | throws JMSException | { | conn.stop(); | session.close(); | conn.close(); | } | | public static void main(String args[]) | throws Exception | { | SendRecvClient client = new SendRecvClient(); | client.sendRecvAsync("A text msg"); | client.done.acquire(); | client.stop(); | System.exit(0); | } | } | Someone can help me, please. Jboss 5.0.0 jboss-messaging-1.4.0.SP3 View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223224#4223224 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223224 _______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
