2 Replies Latest reply on Nov 20, 2006 7:16 PM by Artem Golubev

    MDB does not get messages

    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?

        • 1. Re: MDB does not get messages
          Artem Golubev Newbie

          I have forgotten to say that configuration is default EJB3 without clustering.

          • 2. Re: MDB does not get messages
            Artem Golubev Newbie

            I added my service xml to deployment dir:
            <?xml version="1.0" encoding="UTF-8"?>


            <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager



            but server.log contains the next errors:

            2006-11-20 18:13:31,984 DEBUG [org.jboss.mq.il.uil2.SocketManager] Failed to handle: org.jboss.mq.il.uil2.msgs.CloseMsg18625160[msgType: m_connectionClosing, msgID: -2147483634, error: null]
            java.io.IOException: Client is not connected
            at org.jboss.mq.il.uil2.SocketManager.internalSendMessage(SocketManager.java:264)
            at org.jboss.mq.il.uil2.SocketManager.sendReply(SocketManager.java:238)
            at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:131)
            at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:395)
            at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398)
            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
            at java.lang.Thread.run(Thread.java:619)
            2006-11-20 18:13:31,984 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run
            2006-11-20 18:13:31,984 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOE
            java.net.SocketException: socket closed
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.read(SocketInputStream.java:129)
            at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
            at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
            at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:79)
            at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2247)
            at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2427)
            at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2497)
            at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2569)
            at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2718)
            at java.io.ObjectInputStream.readByte(ObjectInputStream.java:895)
            at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:316)
            at java.lang.Thread.run(Thread.java:619)
            2006-11-20 18:13:31,984 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
            2006-11-20 18:13:31,984 DEBUG [org.jboss.mq.il.uil2.SocketManager] Failed to send error reply
            java.io.IOException: Client is not connected
            at org.jboss.mq.il.uil2.SocketManager.internalSendMessage(SocketManager.java:264)
            at org.jboss.mq.il.uil2.SocketManager.access$800(SocketManager.java:53)
            at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:408)
            at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398)
            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
            at java.lang.Thread.run(Thread.java:619)
            2006-11-20 18:13:31,984 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run