1 2 Previous Next 29 Replies Latest reply on Jul 3, 2012 5:33 AM by ohmygod

    onMessage() is not invoked in JBoss 7.1.1

    ohmygod

      I knew in JBoss 6, the mdb classes need to be packaged to a separate jar so that JBoss could recognize it and the onMessage() will work. But what I am want to ensure is does JBoss 7 also need to do this to make sure the MDB works successfully? Currently, my mdb classes are packaged with all my other classes together in a jar and put in ear\lib.

       

      Or what am I missing on the configuration? Note: the MDB seems to be deployed correctly.

       

      15:43:25,587 INFO  [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011601: Bound messaging object to jndi name java:/queue/com.demo.testMDB
      15:43:25,587 INFO  [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/com.demo.testMDB
      
      
      

      and I have also added related annotation in the testMDB like:

       

      @MessageDriven(messageListenerInterface = MessageListener.class, activationConfig =
      {
              @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/com.demo.testMDB"),
              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
              @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable") })
      @TransactionManagement(value = TransactionManagementType.BEAN)
      
      

       

      and I am sure all this had made the MDB work fine in JBoss 6. Anyone suggests where I have got it wrong in JBoss 7?

        • 1. Re: onMessage() is not invoked in JBoss 7.1.1
          sfcoy

          It's my understanding* that EE components (such as MDBs) should not be packaged in the EAR/lib directory. Try moving your jar to to the root of the EAR file.

           

           

          *§EE.8.4.1 Assembling a Java EE Application - JEE6 Spec.

          • 2. Re: onMessage() is not invoked in JBoss 7.1.1
            ctomc

            Not only to move them to top-level but also mark the jar that contains them as ejb-jar in application.xml

             

             

            --

            tomaz

            • 3. Re: onMessage() is not invoked in JBoss 7.1.1
              ohmygod

              I moved my jar to root of EAR and added module to application.xml, but when deploying I got this error. Any thoughts?

               

              Caused by: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.ejb.default-resource-adapter-name-service not found

                      at org.jboss.msc.service.ServiceContainerImpl.getRequiredService(ServiceContainerImpl.java:447) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.getDefaultResourceAdapterName(MessageDrivenComponentDescriptionFact

              ry.java:273)

                      at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.processMessageBeans(MessageDrivenComponentDescriptionFactory.java:1

              3)

                      at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.processAnnotations(MessageDrivenComponentDescriptionFactory.java:81

               

               

                      at org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.processAnnotations(AnnotatedEJBComponentDescriptionD

              ploymentUnitProcessor.java:58)

                      at org.jboss.as.ejb3.deployment.processors.AbstractDeploymentUnitProcessor.deploy(AbstractDeploymentUnitProcessor.java:81)

                      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                      ... 5 more

              • 4. Re: onMessage() is not invoked in JBoss 7.1.1
                ohmygod

                I followed the docs https://docs.jboss.org/author/display/AS71/Messaging+configuration but finally still cannot get the MDB working (onMessage() is not invoked). Are there other steps that are not mentioned in the documentation? Please suggest.

                • 5. Re: onMessage() is not invoked in JBoss 7.1.1
                  ohmygod

                  Seeing this message, I think the MDB has been deployed successfully. So the reason why onMessage() is not invoked should be some configuration in the MDB class is not annotated correctly

                   

                   

                  15:43:25,587 INFO  [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011601: Bound messaging object to jndi name java:/queue/com.demo.testMDB
                  15:43:25,587 INFO  [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/com.demo.testMDB

                   

                   

                  Could somebody advise where the problem could be? Much appreciated.

                  • 6. Re: onMessage() is not invoked in JBoss 7.1.1
                    sfcoy

                    Are you using the "standalone-full" server configuration?

                     

                    The standard configuration doesn't include messaging.

                    • 7. Re: onMessage() is not invoked in JBoss 7.1.1
                      ohmygod

                      Yes, I have copied the JMS messaging configuration from standalone-full as the documentation guides, but all these do not make onMessage() work...

                      • 8. Re: onMessage() is not invoked in JBoss 7.1.1
                        sfcoy

                        Do you have this bit:

                         

                        {code:xml}<extension module="org.jboss.as.messaging"/>{code}

                        ?

                        • 9. Re: onMessage() is not invoked in JBoss 7.1.1
                          ohmygod
                          • 10. Re: onMessage() is not invoked in JBoss 7.1.1
                            ohmygod

                            If you like, I could attach my standalone.xml. Do you want that to analyze?

                            • 11. Re: onMessage() is not invoked in JBoss 7.1.1
                              sfcoy

                              I'll have a look, but it looks like there is something missing.

                               

                              Please also post the output of

                               

                                   jar -tf yourapp.ear

                              • 12. Re: onMessage() is not invoked in JBoss 7.1.1
                                ohmygod

                                my ear is not a jar file but a folder structure:

                                -web.war

                                -lib

                                   -mylib.jar (contains all my classes including the mdb classes)

                                -META-INF

                                 

                                I can not list all the output of mylib.jar since there are too many classes..

                                 

                                If you do want them, I can attach them as a file.

                                • 13. Re: onMessage() is not invoked in JBoss 7.1.1
                                  sfcoy

                                  The fact that you get an exception when you move the jar to the root of the "ear" tells us two things:

                                  1. This is where it belongs, otherwise the behaviour would be the same;
                                  2. There is something wrong with your configuration

                                   

                                  Please attach your standalone.xml and the complete server log when starting it up with the jar in the root of your folder structure. You should not need an application.xml file.

                                  • 14. Re: onMessage() is not invoked in JBoss 7.1.1
                                    ohmygod

                                    Hi Stephen,

                                     

                                    Thanks for your patience. I moved my jar to the root of EAR and did not use application.xml and found the error:
                                    Caused by: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.ejb.default-resource-adapter-name-service not found

                                     

                                    It seems a little farther from resolving the original problem..

                                     

                                    I attached the standalone.xml and the log file for your analyze. Really appreciated for your help. I am really confused what the problem is for this issue. Let me know what else you need.

                                    1 2 Previous Next