I have integrated JMS in my project and getting the Exception as ActiveMQConnectionFactory cannot be cast to javax.jms.QueueConnectionFactory while calling the JMS receiver from servletcontext listener but it works fine from public static void main method and able to receive message from queue asynchronously.I am able to send the message to queue using queueconnection and queuesession from my web app and using the same qconnection approach in JMS receiver function which implements MessageListener interface.
Can any one suggest me what is the best way to start the JMS receiver or consumer automatically when web app starts because i use servletcontextlistener to start listening the message queue automatically.
(both JMS queuesender and queuereceiver works fine from public static void main method and problem starts only after calling the queuereceiver from contextinitialize method)