5 Replies Latest reply on Mar 24, 2004 12:04 PM by amlgroup

    MDB is not receiving messages

    amlgroup

      I have purchased the JBoss docs and am able to deploy my MDB, and I am also able to create a Queue, look it up and send a JMS message to it -- however, the MDB is not receiving the message because the onMessage() method is never executing. Here are my code snippets, can anyone see a problem?

      ----------------------
      from ejb-jar.xml:
      <message-driven>
      <ejb-name>SeriesTrigger</ejb-name>
      <ejb-class>com.theamlgroup.crm.SeriesTriggerEJB</ejb-class>
      <message-selector></message-selector>
      <transaction-type>Container</transaction-type>
      <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      </message-driven-destination>
      <resource-ref>
      <res-ref-name>jms/QCF</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      </message-driven>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>SeriesTrigger</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>

      ----------------------
      from jboss.xml:

      <enterprise-beans>
      <message-driven>
      <ejb-name>SeriesTrigger</ejb-name>
      <configuration-name>Standard Message Driven Bean</configuration-name>
      <destination-jndi-name>queue/seriesTrigger</destination-jndi-name>
      <resource-ref>
      <res-ref-name>jms/QCF</res-ref-name>
      <jndi-name>ConnectionFactory</jndi-name>
      </resource-ref>
      </message-driven>
      </enterprise-beans>


      ----------------------
      from jbossmq-state.xml:

      < StateManager>
      < Queue>
      < Name>seriesTrigger< /Name>
      < /Queue>
      < /StateManager>

      --------------------------
      from client code: (this is all "working")
      // this first line performs the jndi lookup
      QueueConnectionFactory queConn = serviceLocator.getQueueConnectionFactory("ConnectionFactory");
      QueueConnection con = queConn.createQueueConnection();
      con.start();
      QueueSession sess = con.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
      QueueSender sender = sess.createSender(queue);
      ObjectMessage message = sess.createObjectMessage(event);
      sender.send(message);
      con.close();

      -------------------------------
      i can post my MDB code if needed but it is very simple and standard

      please point out anything you see may be wrong or out of place! thanks in advance.

        • 1. Re: MDB is not receiving messages
          genman


          I can't see what you did wrong, but I assume it's some sort of configuration detail. Please also remember to validate (using "xmllint --valid" on UNIX) your .xml files against the JBoss DTD, as JBoss doesn't do XML validation.

          You should familiarize yourself with the JMX console. It can be very helpful in figuring out problems.

          Here are some basic checks:

          jboss.mq.destination

          1. Check that the queue you're sending to exists and messages are being posted. The depth should be non-zero. (This should be true *until* you deploy your MDB)
          2. Once things get going, the message counter should show some activity


          jboss.j2ee

          1. Check your MDB is listed
          2. Check for your .ear files

          Also, take note of any warnings you see. There's a lot of log spew, but pay attention.

          • 2. Re: MDB is not receiving messages
            amlgroup

            i appreciate the response. i've gotten a little bit further. the situation now is this:

            - if i write a standalone client from the command line that sends a message to the message queue, the MDB is triggered and everything works as expected.

            however...
            - my application sends a message to the queue from within a Stateless Session Bean - the exact same code - however this time the MDB is not triggered.

            has anyone else experienced this or have suggestions on how to debug?

            • 3. Re: MDB is not receiving messages

              Create JmsXAQ
              <tx-connection-factory>
              <jndi-name>JmsXAQ</jndi-name>
              <xa-transaction/>
              <adapter-display-name>JMS Adapter</adapter-display-name>
              <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
              <security-domain-and-application>JmsXAQRealm</security-domain-and-application>
              </tx-connection-factory>
              and use
              <resource-ref>
              <res-ref-name>jms/QCF</res-ref-name>
              <jndi-name>java:/JmsXAQ</jndi-name>
              </resource-ref>
              I am having message sending twice...but it is being send and recieved successfully....I had lot of trouble finding this out...

              • 4. Re: MDB is not receiving messages
                dannyyates

                amlgroup - this sounds like it might be a transaction issue. Is your Session Bean running in a transaction? Are you commiting the JMS transaction (which is different from the CMT managed tx) after your send?

                • 5. Re: MDB is not receiving messages
                  amlgroup

                  thanks, the problem lay with the transaction

                  adding the line

                  queueSession.commit();

                  has fixed the problem...