5 Replies Latest reply on Dec 16, 2010 10:18 AM by jaikiran

    JB 6 CR1: @MessageDriven deployment cleanup issue

    ret

      Hello!

       

      maybe the same Issue as in this thread: http://community.jboss.org/message/573539

      @MessageDriven bean fails to redeploy in JB 6 CR1 if there are configuration-issues and the bean does not get started properly.

       

      on redeployment JB tells me that its already registered, so cleanup does not work correctly.

       

      greetings, Chris

        • 1. Re: JB 6 CR1: @MessageDriven deployment cleanup issue
          jaikiran

          Can you please post that stacktrace?

          • 2. Re: JB 6 CR1: @MessageDriven deployment cleanup issue
            wolfc

            From irc:

            KOTRET wrote:

             

            ah, my zip-program is guilty

            • 3. Re: JB 6 CR1: @MessageDriven deployment cleanup issue
              ret

              hello

               

              "ah, my zip-program is guilty" was related to "bean already registered", because my zip packed it in the wrong hierarchy so it got deployed twice.

              Dont have a stacktrace atm, but it is easy to reproduce: just a small messagedriven-annotated bean and "forget" to define the destination-name (Queuename).

              • 4. Re: JB 6 CR1: @MessageDriven deployment cleanup issue
                ret

                sample code:

                 

                import java.util.concurrent.atomic.AtomicInteger;
                
                import javax.ejb.ActivationConfigProperty;
                import javax.ejb.MessageDriven;
                import javax.jms.JMSException;
                import javax.jms.Message;
                import javax.jms.MessageListener;
                
                
                import org.apache.commons.logging.Log;
                import org.apache.commons.logging.LogFactory;
                
                @MessageDriven(mappedName = "WrapperJMS",
                        activationConfig = {
                            @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
                            // deploy and redeploy with following line
                            //,@ActivationConfigProperty(propertyName="destination", propertyValue="queue/WrapperJMS")
                        }) 
                public class MessageReceiver implements MessageListener {
                    
                    private static final Log LOG = LogFactory.getLog(MessageReceiver.class);
                    private static AtomicInteger messagecount = new AtomicInteger();
                
                
                    /**
                     * Default constructor. 
                     */
                    public MessageReceiver() {
                        if (LOG.isDebugEnabled()) {
                            LOG.debug("init MessageReceiver");
                        }
                    }
                    
                    /**
                     * @see MessageListener#onMessage(Message)
                     */
                    @Override
                    public void onMessage(Message message) {
                        
                        if (message == null) {
                            if (LOG.isErrorEnabled()) {
                                LOG.error("kann Nachricht nicht verarbeiten, da sie NULL ist!");
                            }
                            return;
                        }
                        
                        try {
                            final String ID = message.getJMSMessageID();
                            final int PRIORITY = message.getJMSPriority();
                            final String REFID = message.getJMSCorrelationID();
                            
                            if (LOG.isDebugEnabled()) {
                                LOG.debug("Message #" + messagecount.incrementAndGet() + ": ID=" + ID + ", Priority=" + PRIORITY + ", RefID=" + REFID);
                            }
                            try {Thread.sleep(5000);} catch (InterruptedException e) {e.printStackTrace();}
                            
                        } catch (JMSException e) {
                            e.printStackTrace();
                        }
                    }
                }
                • 5. Re: JB 6 CR1: @MessageDriven deployment cleanup issue
                  jaikiran