3 Replies Latest reply: Dec 28, 2011 6:01 AM by Joseph Hwang RSS

    can't find message-driven bean..

    Joseph Hwang Novice

      I make codes Message-Driven Bean on JBoss 7 and Eclipse Indigo.

      Architecture is

       

      JMSTestEAR

              |

              |--JMSTestEJB (contains Message-Driven Bean)

              |

              |--JMSTestWeb (contains jsp which calls Message-Bean)

       

      And Codes are

       

      ==================Message Driven Bean =====================

       

      @MessageDriven(
        activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
            @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue") })
      public class MDBean implements MessageListener {

          public MDBean() {
              // TODO Auto-generated constructor stub
          }

          public void onMessage(Message message) {
              // TODO Auto-generated method stub
           TextMessage m = (TextMessage) message;
           try {
              System.out.println(m.getText());
           } catch (JMSException e) {
             e.getMessage();
           }
         }

      }

      =============== JSP ============

      ........

      <body>

      <%

      try {

          Context ctx = new InitialContext();

          Queue queue = (Queue) ctx.lookup("queue/testQueue"); //throws Exception

          QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");

          QueueConnection conn = qcf.createQueueConnection();

          QueueSession qs = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

          TextMessage msg = qs.createTextMessage("Hi !");

          QueueSender sender = qs.createSender(queue);

          sender.send(msg);

      } catch (Exception e) {

          out.println(e.getMessage());

      }

      %>

      </body>

      ....

       

      Deploymemts are successful. ear , jar and war are deployed. But JSP throws exception below:

         

         queue/testQueue -- service jboss.naming.context.java.queue.testQueue

       

      Is ejb3 jar deployment succeeded? or do i miss any process in deploying message-driven bean?

      I need your advice! Thanks in advance..

       

      Best regards.