Hi all, I would like to start a broker and Activate a MessageListener on startup of my webApp. I made all the needed configuration to have a ServletContextListener. I can debug inside my ServletContextListener implementation named : ActiveMQBrokerStartListener. You can see the code of it below :
public class ActiveMQBrokerStartListener implements ServletContextListener { BrokerService broker = new BrokerService(); QueueConnection qc = null ; public void contextInitialized(ServletContextEvent arg0) { try{ broker.addConnector("tcp://localhost:61616?trace=true&wireFormat.maxInactivityDuration=-1"); broker.start(); InitialContext ic = new InitialContext(); Context ctx = (Context) ic.lookup("java:comp/env"); ActiveMQConnectionFactory cf = ActiveMQConnectionFactory)ctx.lookup("jms/ConnectionFactory"); qc = (QueueConnection) cf.createQueueConnection(); qc.start() ; QueueSession qs = qc.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE) ; Queue q = (Queue)ctx.lookup("jms/batch"); QueueReceiver qr = qs.createReceiver(q) ; qr.setMessageListener(new Receiver()) ; }catch(Exception e){ System.err.println(e.getMessage()); e.printStackTrace(); throw new RuntimeException(e); } } public void contextDestroyed(ServletContextEvent arg0) { try{ qc.close() ; broker.stop(); }catch(Exception e){ System.err.println(e.getMessage()); e.printStackTrace(); throw new RuntimeException(e); } } } I place a breakpoint on the line that should create a QueueSession. But never enter in it. If i place a breakpoint on the ligne that createQueueConnection i have it. So the problem is on the qc.start() ; If i inspect the QueueConnection i can see that the started=false as normal. What is wrong on my code ? Could you help me, or tell me what you think about this ? Regards, Denez -- View this message in context: http://www.nabble.com/Error-on-starting-QueueConnection-tf4278515s2354.html#a12178078 Sent from the ActiveMQ - User mailing list archive at Nabble.com.