0 Replies Latest reply on Nov 20, 2006 3:35 PM by Artem Golubev

    EJB3 MDB

    Artem Golubev Newbie

      Hi,
      My MDB bean does not get messages.
      On deployment it writes:
      INFO [EJBContainer] STARTED EJB: com.nexplore.messagebus.ShoppingCartDispatcher ejbName: queue/ShoppingCartDispatcher
      WARN [MessagingContainer] Could not find the queue destination-jndi-name=queue/ShoppingCartDispatcher
      WARN [MessagingContainer] destination not found: queue/ShoppingCartDispatcher reason: javax.naming.NameNotFoundException: ShoppingCartDispatcher not bound
      WARN [MessagingContainer] creating a new temporary destination: queue/ShoppingCartDispatcher
      INFO [ShoppingCartDispatcher] Bound to JNDI name: queue/ShoppingCartDispatcher
      INFO [EJB3Deployer] Deployed: file:/C:/Apps/JBoss405/server/nexplore/deploy/mb-ejb.jar


      MDB:
      @MessageDriven(name="queue/ShoppingCartDispatcher",
      activationConfig={
      @ActivationConfigProperty(
      propertyName="destination",
      propertyValue="queue/ShoppingCartDispatcher"),
      @ActivationConfigProperty(
      propertyName="destinationType",
      propertyValue="javax.jms.Queue"),
      @ActivationConfigProperty(
      propertyName="messageSelector",
      propertyValue="MessageFormat = 'Version 3.4'"),
      @ActivationConfigProperty(
      propertyName="acknowledgeMode",
      propertyValue="Auto-acknowledge")})
      public class ShoppingCartDispatcher implements MessageListener {

      @EJB private ShoppingCartLocal shoppingCart;

      public void onMessage(Message msg) {
      try {
      System.out.println("OK");
      } catch (Exception e) {
      ...
      }
      }
      }



      Sender:
      public @Stateless class ShoppingCartSenderBean implements ShoppingCartSender {
      @Resource(mappedName="ConnectionFactory")
      private ConnectionFactory connectionFactory;

      @Resource(mappedName="queue/ShoppingCartDispatcher")
      private Queue queue;


      public void sendPayment(String item, String amount) throws JMSException {
      Connection connect = connectionFactory.createConnection();
      Session session = connect.createSession(true, 0);
      ObjectMessage msg = session.createObjectMessage();
      MessageProducer producer = session.createProducer(queue);
      PayDTO pay = new PayDTO();
      pay.setItem(item);
      pay.setAmount(new BigDecimal(amount));
      msg.setObject(pay);

      producer.send(msg);
      connect.close();

      }

      }

      I can not find out what is the problem?
      May be MDB annotation is incorrect?