1 2 Previous Next 29 Replies Latest reply on Feb 18, 2011 5:16 AM by jaikiran

    onMessage method does not receive message

    honeychen03

      First I am using JBoss 6.0.0.Final.

       

      Is there any other things that I need to do?

      I configured following in my MDB

       

      @MessageDriven(activationConfig =

      {

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/com.globalsight.everest.jms.WorkflowAdditions"),

              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

              @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable")})

       

      and added below queue into hornetq-jms.xml

      <queue name="WorkflowAdditions">

          <entry name="queue/com.globalsight.everest.jms.WorkflowAdditions"/>

      </queue>

       

      JBoss started correctly BUT after jms sends the messge, the onMessage method does not receive the messge in. Note: I have removed ejb-jar.xml and jboss.xml for these ejb configurations (only for MDB)

       

      Please advise.

        • 1. onMessage method does not receive message
          nickarls

          See in the log that the queue is created?

          • 2. onMessage method does not receive message
            honeychen03

            You mean the jboss console? no queue created log in the console after I quit using the ejb-jar xml and jboss.xml. Any more is needed to do?

            • 3. onMessage method does not receive message
              nickarls

              Try making a typo in the queue name of the MDB, I think deploy should fail if the queue is not found (at least then we'll know if there is a queue or not)

              • 4. onMessage method does not receive message
                honeychen03

                Do you mean this name <queue name="WorkflowAdditions">? This name is just a meaningless string. Does it need to be pointing to somewhere?

                • 5. onMessage method does not receive message
                  nickarls

                  Try

                   

                  @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/ladjflajksdflkajsdflkjasfd"),

                   

                  If it fails to deploy (and it deployed before) it means that the original queue existed.

                  • 6. onMessage method does not receive message
                    honeychen03

                    BTW, the jms message is sent successfully. Following is the code:

                     

                    Context context = s_appServer.getNamingContext();

                            Queue queue = (Queue) context.lookup("queue/com.globalsight.everest.jms.WorkflowAdditions");

                            QueueSender sender = s_queueSession.createSender(queue);

                            ObjectMessage om = s_queueSession.createObjectMessage(p_msg);

                     

                            sender.send(om);

                            sender.close();

                     

                    But there is no response in the onMessage() method. Why?

                    • 7. onMessage method does not receive message
                      nickarls

                      Show the code of the MDB. How is it deployed?

                      • 8. onMessage method does not receive message
                        honeychen03

                        I just removed ejb-jar.xml and jboss.xml which were successfully deployed with the MDBs.

                         

                        And then added annotation in the MDB. No other changes were made. I thought it could be easily working. Currently for the MDB configuration, only hornetq-configuration.xml and hornetq-jms.xml are put at .ear\META-INF directory.

                         

                        Here is the main content of the MDB:

                         

                        @MessageDriven(activationConfig =

                        {

                                @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/com.globalsight.everest.jms.WorkflowAdditions"),

                                @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

                                @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable")})

                               

                        @TransactionManagement(value = TransactionManagementType.BEAN)

                        /**

                        * This is the concrete implementation of the WorkflowAdditionListener.

                        */

                        public class WorkflowAdditionMDB extends GenericQueueMDB

                        {

                        public WorkflowAdditionMDB()

                            {

                                super();

                            }

                         

                        @Override

                            public void onMessage(Message p_cxeRequest)

                            {

                                ....

                             }

                        }

                         

                        GenericQueueMDB is an abstract class implemented MessageDrivenBean and MessageListener.

                         

                        I also tried the class name like this public class WorkflowAdditionMDB implements MessageListener but the same result.

                        • 9. Re: onMessage method does not receive message
                          jaikiran

                          Where exactly in the .ear is this class located? Can you post the output of:

                           

                          jar -tf yourapp.ear

                          • 10. Re: onMessage method does not receive message
                            honeychen03

                            The class is packaged in my project jar located at deploy\myproject.ear\lib\myproject.jar and the location of the class in the jar is com/globalsight/everest/workflowmanager/WorkflowAdditionMDB.class.

                             

                            BTW, myproject.ear is just a folder under deploy directory, not a jar.

                            • 11. onMessage method does not receive message
                              jaikiran

                              The EJB annotations (and other Java EE component annotations) will not be scanned for jars in .ear/lib folder. So move it to the root of the .ear at myproject.ear/myproject.jar.

                              • 12. Re: onMessage method does not receive message
                                honeychen03

                                Then this will not affect to find other classes from myproject.jar? Does putting the jar in .ear\lib and .ear have difference during runtime of my system?

                                • 13. Re: onMessage method does not receive message
                                  jaikiran

                                  just lee wrote:

                                   

                                  Then this will not affect to find other classes from myproject.jar?

                                  You can put your interfaces and other libraries which need to be accessed by other classes, in the .ear/lib folder. But component implementation classes like this MDB (which shouldn't be referred to by other classes) shouldn't be part of the jars in .ear/lib.

                                  • 14. Re: onMessage method does not receive message
                                    honeychen03

                                    Sorry, forgive me. I am a bit new to jboss. Can you explain a little bit about what component implementation classes are so that I can tell what classes should be put in.ear and what classes go to .ear/lib?

                                    1 2 Previous Next