0 Replies Latest reply on Apr 2, 2007 9:57 AM by fidi

    My MDB can´t access a Queue.

    fidi

      I built a JMS as Producer to put messages in a Queue. In another application in another JBoss there is a MDB to access that Queue.
      I check by jmx-console that the messages are being delivered with success in the Queue. But the MDB cant access that Queue. My Queue its called "filaMalefica".

      my files:

      - ejb-jar.xml



      <?xml version="1.0"?>
      
      <!DOCTYPE ejb-jar PUBLIC
       '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN'
       'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
      
      <ejb-jar>
      
       <enterprise-beans>
      
       <message-driven>
       <display-name>JmsMonsterBean</display-name>
       <ejb-name>JmsMonster</ejb-name>
       <ejb-class>JmsMonsterBean</ejb-class>
      
       <messaging-type>javax.jms.MessageListener</messaging-type>
       <transaction-type>Container</transaction-type>
       <message-destination-type>javax.jms.Queue</message-destination-type>
       <activation-config>
       <activation-config-property>
       <activation-config-property-name>destinationType</activation-config-property-name>
       <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
       </activation-config-property>
      
       <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-property>
       <activation-config-property-name>subscriptionDurability</activation-config-property-name>
       <activation-config-property-value>NonDurable</activation-config-property-value>
       </activation-config-property>
       </activation-config>
      
       </message-driven>
      
       </enterprise-beans>
      
      </ejb-jar>
      
      
      
      



      jboss.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
       "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
      
      <jboss>
      
       <enterprise-beans>
       <message-driven>
       <ejb-name>JmsMonster</ejb-name>
       <destination-jndi-name>queue/filaMalefica</destination-jndi-name>
       </message-driven>
       </enterprise-beans>
      
      </jboss>
      


      JmsMonsterBean.class

      
      import javax.ejb.EJBException;
      import javax.ejb.MessageDrivenBean;
      import javax.ejb.MessageDrivenContext;
      import javax.jms.Message;
      import javax.jms.MessageListener;
      
      public class JmsMonsterBean implements MessageDrivenBean, MessageListener
      {
      
       private MessageDrivenContext ctx = null;
      
       public JmsMonsterBean( ) { }
      
       public void setMessageDrivenContext(MessageDrivenContext ctx)
       throws EJBException {
       this.ctx = ctx;
       }
      
       /**
       * Required creation method for message-driven beans.
       */
       public void ejbCreate( ) {
       // no specific action required for message-driven beans
       }
      
       /** Required removal method for message-driven beans. */
       public void ejbRemove( ) {
       ctx = null;
       }
      
       /**
       * Implements the business logic for the MDB.
       *
       * @param message The JMS message to be processed.
       */
       public void onMessage(Message message)
       {
       System.out.println("JmsMonsterBean.onMessage( ): Received message.");
       System.out.println(message);
       }
      }
      
      


      Thanks!