3 Replies Latest reply: Jul 29, 2004 9:56 AM by Vijay G RSS

    MDB -Problems Recieving Messages

    Vijay G Newbie

      I have a Simple MDB which logs the message from a queue. When i deploy the bean, it looks like its ignoring the destination i have given and it creates a temporary queue and listens for messages from the queue.

      The MDB
      public class AFMessageProcessorBean implements MessageDrivenBean, MessageListener{
       private final static Logger log = Logger.getLogger("com.vfa.assetfusion.queue.AFMessageProcessor");
       private MessageDrivenContext ctx = null;
       public void setMessageDrivenContext(MessageDrivenContext ctx){
       this.ctx = ctx;
       public void ejbCreate(){
       public void ejbRemove(){
       this.ctx = null;
       public void onMessage(Message msg){
       TextMessage tm = (TextMessage) msg;
       String text = tm.getText();
       log.debug("I am from the MDB");
       catch(JMSException e){
       log.error("onMessage error", e);

      <?xml version="1.0"?>

      <?xml version="1.0"?>
      <!DOCTYPE ejb-jar
       PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
       <message-selector>MessageFormat = 'Version 3.4'</message-selector>

        • 1. Re: MDB -Problems Recieving Messages
          Stephane Nicoll Master

          Jboss creates a temporary destination only if the queue does not exist at the time the MDB is deployed. Are you sure queue/test is created first? In which file are you declaring it?

          Also, you can add a depends tag in your jboss.xml to depend on the Queue's MBean.



          • 2. Re: MDB -Problems Recieving Messages
            Vijay G Newbie

            I modified jboss-destinations-service.xml to add my queue. Here is log.
            Take look at the timestamp. The queue gets deployed before the bean. But still it looks for the wrong destination and throwing an exception

            09:01:56,437 INFO [vfa] Bound to JNDI name: queue/vfa
            09:01:56,437 INFO [vfa] Started jboss.mq.destination:service=Queue,name=vfa

            09:01:56,997 INFO [EjbModule] Deploying AFMessageProcessorEJB
            09:01:57,168 WARN [JMSContainerInvoker] destination not found: queue/AFMessageProcessorEJB reason: javax.naming.NameNotFoundException: AFMessageProcessorEJB not bound
            09:01:57,168 WARN [JMSContainerInvoker] creating a new temporary destination: queue/AFMessageProcessorEJB
            09:01:57,178 INFO [AFMessageProcessorEJB] Bound to JNDI name: queue/AFMessageProcessorEJB
            09:01:57,178 INFO [AFMessageProcessorEJB] Started jboss.mq.destination:service=Queue,name=AFMessageProcessorEJB
            09:01:57,258 INFO [DLQHandler] Started null
            09:01:57,258 INFO [JMSContainerInvoker] Started jboss.j2ee:binding=message-driven-bean,jndiName=local/AFMessageProcessorEJB,plugin=invoker,service=EJB
            09:01:57,258 INFO [MessageDrivenInstancePool] Started jboss.j2ee:jndiName=local/AFMessageProcessorEJB,plugin=pool,service=EJB
            09:01:57,258 INFO [MessageDrivenContainer] Started jboss.j2ee:jndiName=local/AFMessageProcessorEJB,service=EJB
            09:01:57,258 INFO [EjbModule] Started jboss.j2ee:module=afmsgproc.jar,service=EjbModule
            09:01:57,258 INFO [EJBDeployer] Deployed: file:/C:/TEMP/jboss-3.2.3/server/all/deploy/afmsgproc.jar
            09:01:57,308 INFO [MainDeployer] Deployed package: file:/C:/TEMP/jboss-3.2.3/server/all/deploy/afmsgproc.jar

            • 3. Re: MDB -Problems Recieving Messages
              Vijay G Newbie

              Fixed it. jboss.xml was not in the right format.
              It was missing the jboss tag at the start
              Thanks everyone for your replies