11 Replies Latest reply on Jan 31, 2013 3:30 PM by hitjain_83

    MDB not recognized as a consumer in JBoss EAP 5.1.2

    jhannah

      Hello,

       

      I had an application running in JBoss AS 6.1, however, we're looking to transition to JBoss EAP 5.1.2.  My application uses MDBs configured within jboss.xml and ejb-jar.xml files.  Unfortunately, when I run my application, the MDBs are not registered with the queues as consumers as the JBoss Admin shows the consumer count for my queues as 0.  I can add messages to the queue successfully, but since there are no MDBs consuming, the message never gets consumed.

       

      Is there something missing from the jboss.xml or ejb-jar.xml that is required in JBoss EAP 5.1.2 (see my files below)?  Or, is there some step during HornetQ installation that I may have missed that will enable MDBs? (JBoss AS 6.1 didn't require a separate HornetQ installation, so I may have missed something).

       

      Any suggestions would be appreciated.

       

      Thanks,

       

      jhannah

       

      jboss.xml:
      <?xml version="1.0" encoding="utf-8"?>
      <jboss xmlns:xs="http://www.jboss.org/j2ee/schema"
      xs:schemaLocation="http://www.jboss.org/j2ee/schema jboss_5_0.xsd"
      version="5.0">

      <enterprise-beans>
        <message-driven>
         <ejb-name>PendingConsumer</ejb-name>
         <destination-jndi-name>/queue/PendingQueue</destination-jndi-name>
        </message-driven>
        <message-driven>
         <ejb-name>RequestConsumer</ejb-name>
         <destination-jndi-name>/queue/RequestQueue</destination-jndi-name>
        </message-driven>
      </enterprise-beans>
      </jboss>

       

      ejb-jar.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
      version="3.0">

      <enterprise-beans>
        <message-driven>
         <ejb-name>PendingConsumer</ejb-name>
         <ejb-class>net.rim.serviceplan.services.workers.PendingConsumer</ejb-class>
         <transaction-type>Bean</transaction-type>
         <message-destination-type>javax.jms.Queue</message-destination-type>
         <activation-config>  
          <activation-config-property>
           <activation-config-property-name>acknowledgeMode</activation-config-property-name>
           <activation-config-property-value>AUTO_ACKNOWLEDGE</activation-config-property-value>
          </activation-config-property>
         </activation-config>
        </message-driven>
        <message-driven>
         <ejb-name>RequestConsumer</ejb-name>
         <ejb-class>net.rim.serviceplan.services.workers.RequestConsumer</ejb-class>
         <transaction-type>Bean</transaction-type>
         <message-destination-type>javax.jms.Queue</message-destination-type>
         <activation-config>  
          <activation-config-property>
           <activation-config-property-name>acknowledgeMode</activation-config-property-name>
           <activation-config-property-value>AUTO_ACKNOWLEDGE</activation-config-property-value>
          </activation-config-property>
         </activation-config>
        </message-driven>
      </enterprise-beans>
      </ejb-jar>

        • 1. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
          ataylor

          are you using eap with JBM or HornetQ, also make sure the resource adapters are configured correctly, im guessing your using the wrong one. the manual has a section on this i seem to remember.

          • 2. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
            jhannah

            I am using HornetQ.  It doesn't come packaged with EAP 5.1.2, so I've installed the additional component.  I'll see if I can find that section on resource adapters and try to verify that they're configured properly.  Thanks for the tip.

             

            Cheers,

             

            jhannah

            • 3. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
              ataylor

              you need to replace the default resource adapter with the hornetq one, copying the one you have in the jbossas version should do it, i.e. the jms-ra dir and the jms-ds.xml config.

              • 4. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                jhannah

                The jms-ra dir and the jms-ds.xml already exist and pretty much match my AS 6.1 versions.  These must have been added during the HornetQ installation.

                 

                I see that the documentation states that as of AS 6.1, there is no longer a need to specify the resource adapter, as the default will be used automatically.  So I assume that the lack of a resource adapter being specified could cause my problem.  I've tried adding the element <resource-adapter-name>hornetq-ra.rar</resource-adapter-name> to my jboss.xml, however, still no luck.

                 

                jhannah

                • 5. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                  ataylor

                  the resource adapter element matches the location of the resource adapter, default is jms-ra if you dont supply it

                  • 6. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                    jhannah

                    Are you aware of any examples with an MDB configured with ejb-jar.xml and jboss.xml that will run in EAP 5.1.2?  I must have omitted something that's causing the MDBs to not become consumers.

                     

                    Thanks,


                    jhannah

                    • 7. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                      ataylor

                      to be honest, they work out of the box for me. are you sure your MDB's are being deployed?

                      • 8. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                        jhannah

                        My application is being deployed without any errors.  I can use my services via resteasy and access my db via hibernate.  It just appears as though my MDBs don't even exist... which leads me to believe there's an error in my MDB configuration.

                         

                        Most the examples use the annotation approach but I need to follow the jboss.xml/ejb-jar.xml model.  Do you know of any such examples that I could try?


                        Thanks,

                         

                        jhannah

                        • 9. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                          ataylor

                          sorry i dont, if your using eap then yopu could go thru the support channels, they would be able to help you, its really an AS issue rather than HornetQ

                          • 10. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                            jhannah

                            As Andy mentioned, this turned out to not really be a HornetQ problem.  But in case anyone is interested in the cause... here's a summary:

                             

                            Our issue was due to the way we had packaged our application.  There was an EJB being deployed within an exploded WAR.  This worked fine in JBoss AS 6.1 because it uses JavaEE6.  Specifying EJBs within a war is not supported in JavaEE5, which is used by JBoss EAP 5.1.2, so that same deployment did not work.  Our MDBs were silently failing their deployment.  Moving the EJBs out of the war allowed for the MDBs to be deployed properly and are now recognized as consumers on the queues.

                             

                            Cheers,

                             

                            jhannah

                            • 11. Re: MDB not recognized as a consumer in JBoss EAP 5.1.2
                              hitjain_83

                              Hi Jhannah/Others,

                               

                              Can you please elaborate on the fix that you provided.

                              I am trying to do a similar thing -

                              Deploying an MDB created within an EJB project and deployed as an EAR on the server.

                               

                              The system is looking to deploy the EAR but then fails with:

                                          Caused by: javax.management.InstanceNotFoundException: jboss.jca:service=RARDeployment,name='jms-ra.rar' is not registered.

                              since I DO NOT have a jms-ra.rar instead I have hornetq-ra.rar

                               

                              I am using the same ejb-jar.xml and an mdb configured on it.

                               

                              Please let me know what exactly you did to fix this on EAP 5.1.2