I have checked the servlet code and it is working. I wrote a class that uses QueueBrowser to check the messages. All of the messages I sent are on the Queue.
Here is the code for the servlet: | package com.hott.servlets; | import javax.jms.*; | import javax.naming.*; | import javax.servlet.http.*; | import javax.servlet.*; | import java.io.*; | import java.util.Properties; | /** | * sends messages to a JMS queue that will be processed by a Message Driven Bean | */ | public class MyMessageServlet extends HttpServlet { | | QueueConnection queueConnection = null; | QueueSession queueSession = null; | Queue queue = null; | QueueSender queueSender = null; | TextMessage message = null; | | public void init() { | Properties env = new Properties(); | env.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); | env.put("java.naming.provider.url","localhost:1099"); | env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"); | try { | Context jndiContext = new InitialContext(env); | QueueConnectionFactory queueConnectionFactory = | (QueueConnectionFactory) jndiContext.lookup("ConnectionFactory"); | queue = (Queue) jndiContext.lookup("queue/testQueue"); | queueConnection = queueConnectionFactory.createQueueConnection(); | queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); | queueSender = queueSession.createSender(queue); | message = queueSession.createTextMessage(); | } catch (JMSException e) { | e.printStackTrace(); | } catch (NamingException ne){ | ne.printStackTrace(); | } | } | | public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | String text = req.getParameter("message"); | resp.setContentType("text/html"); | PrintWriter out = resp.getWriter(); | out.println("<html><head><title>Send Results</title></head><body>"); | try { | message.setText(text); | out.println("Sending message: <b>" + message.getText()+"</b><br>"); | queueSender.send(message); | out.println("Your message has been sent successfully."); | } catch (JMSException e) { | out.println("Your message was not sent."); | } finally { | out.println("</body></html>"); | } | } | | public void destroy(){ | if (queueConnection != null) { | try { | queueConnection.close(); | } catch (JMSException e) {} | } | } | } | View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3850042#3850042 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3850042 ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user