6 Replies Latest reply on Jul 24, 2012 12:44 PM by leonardo.devai

    MDB does not get started in EAR file

    ktfan

      I have the following MDB which can be started with WAR file, but when I deployed the same MDB into EAR file, it just does not get started. Anyone has faced the same problem before ? Any pointers will be appreciated.

       

       

       

      @MessageDriven(name = "MessageMDBQueueSample" , activationConfig = {

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

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

                     @ActivationConfigProperty(propertyName = "acknowledgeMode" , propertyValue = "Auto-acknowledge" ) })

       

       

       

       

      public class MDBQueueSample implements MessageListener{

       

       

              public void onMessage(Message message) {

                   

                    ObjectMessage objectMessage = (ObjectMessage)message;

                    System.out.println("I AM HERE");

             }

            

              @PostConstruct

              public void mdbInit()

             {

                    System. out.println("Doing Post Construct...." );       

             }

            

              @PreDestroy

              public void cleanUp()

             {

                    System. out.println("Doing Cleaning-up........" );

             }

      }

        • 1. Re: MDB does not get started in EAR file
          leonardo.devai

          Are you running it on the standard JBoss AS7 configuration?

          You will have to enable messaging extension and configure it on the default configuration, standalone.xml

           

          See standalone-full.xml for configuration sample, and this link:

          https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-Messaging

          • 2. Re: MDB does not get started in EAR file
            wdfink

            Or you might use 'bin/standalone.sh --server-config=standalone-full.xml', if you need ha and clustering try 'standalone-full-ha.xml'.

            • 3. Re: MDB does not get started in EAR file
              ktfan

              Yes, I am using standalone-full.xml. With same configuration, when deploying the MDB in WAR file, it will get started. But when I deploy the MDB in EAR file, it does not get started at all, no exception being thrown as well. I am using JBOSS AS 7.1.1 final

               

              Do you need me to provide more info on this ?

              • 4. Re: MDB does not get started in EAR file
                leonardo.devai

                What is your EAR packaging structure and, if you have an application.xml, how is it referencing the (I suppose) EJB JAR containing the MDB's?

                 

                 

                 

                 

                My structure:

                 

                ./testEAR.ear

                ./testEAR.ear/testEJB.jar

                ./testEAR.ear/testEJB.jar/META-INF

                ./testEAR.ear/testEJB.jar/META-INF/MANIFEST.MF

                ./testEAR.ear/testEJB.jar/TestMDB.class

                 

                 

                Logs:

                 

                10:38:24,182 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found testEAR.ear in deployment directory. To trigger deployment create a file called testEAR.ear.dodeploy

                10:38:24,229 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "testEAR.ear"

                10:38:24,276 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "testEJB.jar"

                10:38:24,557 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) JBAS014142: Started message driven bean 'MessageMDBQueueSample' with 'hornetq-ra' resource adapter

                10:38:24,870 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "testEAR.ear"

                1 of 1 people found this helpful
                • 5. Re: MDB does not get started in EAR file
                  ktfan

                  Thanks Leonardo for the advice. I did incorrectly put the MDB in my lib folder inside the EAR file therefore the MDB was not started. Once I move it out , it is working fine now.

                  • 6. Re: MDB does not get started in EAR file
                    leonardo.devai

                    Glad to hear.