5 Replies Latest reply on Mar 23, 2002 11:00 AM by echofloripa

    MDB not receiving msgs

    echofloripa

      I have a MDB succefully deployed, but when I try to send messages (no error) my MDB is not receiving the msgs, as it woul'd print statements to System.out...

      Here goes my mdb code and deployment desc, besides the client:

      jboss.xml

      <?xml version="1.0" encoding="Cp1252"?>

      <enterprise-beans>
      <message-driven>
      <ejb-name>ProcessadorDeMovimentacao</ejb-name>
      <destination-jndi-name>queue/Queue</destination-jndi-name>
      </message-driven>
      </enterprise-beans>



      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>
      Message-Driven Beans
      <enterprise-beans>
      <message-driven>

      <ejb-name>ProcessadorDeMovimentacao</ejb-name>
      <ejb-class>cobranca.ProcessadorDeMovimentacao</ejb-class>
      <message-selector></message-selector>
      <transaction-type>Bean</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      </message-driven-destination>
      <subscription-durability>NonDurable</subscription-durability>
      <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      </message-driven>
      </enterprise-beans>
      <assembly-descriptor>
      </assembly-descriptor>
      </ejb-jar>


      MDB code

      public class ProcessadorDeMovimentacao implements MessageDrivenBean
      {
      private MessageDrivenContext messageContext;

      public void ejbCreate()
      {
      System.out.println("MessageLogger.ejbCreate()");
      }

      public void onMessage(Message message)
      {
      System.out.println("Received message: " + message);

      try
      {
      ...

      client code :

      InitialContext ctx=new InitialContext();
      // Lookup a JMS connection factory
      QueueConnectionFactory conFactory =(QueueConnectionFactory) ctx.lookup("QueueConnectionFactory");
      // Create a JMS connection
      QueueConnection connection = conFactory.createQueueConnection();
      connection.start();
      // Create a JMS session object
      QueueSession session = connection.createQueueSession(true,0);
      // Lookup a JMS queue
      Queue queue= (Queue) ctx.lookup("queue/Queue");
      // Create a JMS sender
      QueueSender sender = session.createSender(queue);

      Enumeration enum=vetor.elements();
      ObjectMessage message=null;
      while(enum.hasMoreElements())
      {
      Movimento mov=(Movimento) enum.nextElement();
      message=session.createObjectMessage(mov);
      sender.send(message);
      }

      ...

      jndi file

      ### JBossNS properties
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      What it could be??
      obs: i configured a queue in jboss.jcml




      Regards...
      Emerson

        • 1. Re: MDB not receiving msgs

          Firtst: your queue is not named the same, you name it queue/Queue on some place and queue/queue on someother.

          Turn on debugging and possibly trace and look into the logfile.

          //Peter

          • 2. Re: MDB not receiving msgs
            echofloripa

            how do I turn debug on???

            • 3. Re: MDB not receiving msgs
              echofloripa

              Please, someone HELP ME!!!

              • 4. Re: MDB not receiving msgs

                Look into conf/default/ or conf/tomcat log4j.properties

                //Peter

                • 5. Re: MDB not receiving msgs
                  echofloripa

                  # A log4j properties file suitable for replacing the
                  # default JBoss ConsoleLogging & FileLogging mbeans.

                  log4j.rootCategory=DEBUG, Default, Console

                  ### The server.log file appender
                  log4j.appender.Default=org.apache.log4j.RollingFileAppender
                  log4j.appender.Default.File=../log/server.log
                  log4j.appender.Default.MaxFileSize=500KB
                  log4j.appender.Default.MaxBackupIndex=1
                  log4j.appender.Default.layout=org.apache.log4j.PatternLayout
                  # Use the default JBoss format
                  log4j.appender.Default.layout.ConversionPattern=[%d{ABSOLUTE},%c{1}] %m%n
                  # Truncate if it aleady exists.
                  log4j.appender.Default.Append=false
                  #Example of turning off logging for a category. Uncomment to turn off.
                  #log4j.category.DefaultDS=FATAL

                  ### The console appender
                  log4j.appender.Console=org.jboss.logging.log4j.ConsoleAppender
                  log4j.appender.Console.Threshold=INFO
                  log4j.appender.Console.layout=org.apache.log4j.PatternLayout
                  log4j.appender.Console.layout.ConversionPattern=[%p,%c{1}] %m%n

                  # Example of only showing INFO msgs for any categories under org.jboss.util
                  #log4j.category.org.jboss.util=INFO

                  # An example of enabling the custom TRACE level priority that is used
                  # by the JBoss internals to diagnose low level details. This example
                  # turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
                  # subpackages. This will produce A LOT of logging output.
                  #log4j.category.org.jboss.ejb.plugins=TRACE#org.jboss.logging.TracePriority


                  and???

                  Thanks in advance : )