9 Replies Latest reply on May 29, 2010 2:04 AM by peppi

    Can not receive JMS message in JBoss AS 6.0.0.M3

      Hi

       

      I have a MDB (EJB3) which is listening to the queue "queue/testMsg"  configured in HornetQ. And deploy the ear in JBoss AS 6 M3.

       

      I can send my queue(check the MessageCount in jmx-console is 1), but I can not handle it by MessageListener.onMessage() and the JBoss has not any error log. I can receive it by MessageConsumer.

       

      Please help me and find out the reason.

       

      1. hornetq-jms.xml

      <configuration xmlns="urn:hornetq"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

         <connection-factory name="ConnectionFactory">
            <connectors>
               <connector-ref connector-name="netty"/>
            </connectors>
            <entries>
               <entry name="ConnectionFactory"/>
               <entry name="XAConnectionFactory"/>
            </entries>
         </connection-factory>

         <queue name="testMsg">
            <entry name="queue/testMsg"/>
         </queue>

      </configuration>

       

      2. send queue

         queueSession = queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
         QueueSender queueSender = queueSession.createSender(queue);

       

         ObjectMessage message = queueSession.createObjectMessage(testMsg);//testMsg is my ObjectMessage
         queueSender.send(message);

       

      3. MessageListener

      @MessageDriven(activationConfig = {
              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
              @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testMsg")}
      )
      @ResourceAdapter("hornetq-ra.rar")
      public class MessageEJB3 implements MessageListener {

          public void onMessage(Message message) {
              System.out.println("Handle the message........");

          }
      }

       

      Thanks!!!

        • 1. Re: Can not receive JMS message in JBoss AS 6.0.0.M3
          jaikiran
          @ResourceAdapter("hornetq-ra.rar")

           

           

          In 6.0.0.M3 you don't have to add that. The HornetQ resource adapter is deployed under jms-ra.rar. Infact to get JMS (backed by HornetQ) working in JBoss AS 6.0.0.M3, you don't have to change anything. Just download the AS and deploy your MDBs without changing any of the JBoss AS config files.

          • 2. Re: Can not receive JMS message in JBoss AS 6.0.0.M3

            Thanks for your reply!

             

            I remove the @ResourceAdapter("hornetq-ra.rar") and rebuild the ear. But I still can not receive message.

            • 3. Re: Can not receive JMS message in JBoss AS 6.0.0.M3

              I use JBoss 6 default queue name ExpiryQueue or DLQ which are configured in %JBoss_Home%\server\default\deploy\hornetq\hornetq-jms.xml

              I can not receive the message by MessageListener.onMessage(). I login jmx-console to check ExpiryQueue's MessageCount, it is 2.

               

              I wonder why my MessageListener can not be called.

              • 4. Re: Can not receive JMS message in JBoss AS 6.0.0.M3

                Who can help me? It takes me 5 days. And I can not continue.

                • 5. Re: Can not receive JMS message in JBoss AS 6.0.0.M3
                  jaikiran

                  David K wrote:

                   

                  I wonder why my MessageListener can not be called.

                  You mean your MDB is not being invoked? Is that right?

                   

                  Can you post the logs from the console (not server.log) from the time your application is being deployed?

                  • 6. Re: Can not receive JMS message in JBoss AS 6.0.0.M3

                    Thank you jaikiran.

                     

                    This is the log:

                     

                    13:23:07,112 INFO  [AbstractJBossASServerBase] Server Configuration:
                            JBOSS_HOME URL: file:/E:/jboss-6.0.0-M3/
                            Bootstrap: $JBOSS_HOME\server/default/conf/bootstrap.xml
                            Common Base: $JBOSS_HOME\common/
                            Common Library: $JBOSS_HOME\common/lib/
                            Server Name: default
                            Server Base: $JBOSS_HOME\server/
                            Server Library: $JBOSS_HOME\server/default/lib/
                            Server Config: $JBOSS_HOME\server/default/conf/
                            Server Home: $JBOSS_HOME\server/default/
                            Server Data: $JBOSS_HOME\server/default/data/
                            Server Log: $JBOSS_HOME\server/default/log/
                            Server Temp: $JBOSS_HOME\server/default/tmp/

                    13:23:07,128 INFO  [AbstractServer] Starting: JBossAS [6.0.0.20100429-M3 "Neo"]
                    13:23:11,924 INFO  [ServerInfo] Java version: 1.6.0_18,Sun Microsystems Inc.
                    13:23:11,940 INFO  [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
                    13:23:11,940 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Server VM 16.0-b13,Sun Microsystems Inc.
                    13:23:11,940 INFO  [ServerInfo] OS-System: Windows XP 5.1,x86
                    13:23:11,940 INFO  [ServerInfo] VM arguments: -Dprogram.name=run.bat -Xms512M -Xmx1024M -XX:PermSize=64m -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Xdebug -Xnoagen
                    13:23:12,018 INFO  [JMXKernel] Legacy JMX core initialized
                    13:23:25,549 INFO  [AbstractServerConfig] JBoss Web Services - Native Server 3.3.0.CR1.SP2
                    13:23:37,596 警告    [FileConfigurationParser] AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal
                    13:23:56,237 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@12745956{vfs:///E:/jboss-6.0.0-M3/server/default/deploy/test.ear/test.jar/}
                    13:23:56,237 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@12745956{vfs:///E:/jboss-6.0.0-M3/server/default/deploy/test.ear/test.jar/}
                    13:23:56,237 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@12745956{vfs:///E:/jboss-6.0.0-M3/server/default/deploy/test.ear/test.jar/}
                    13:23:58,456 警告    [FileConfigurationParser] AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal
                    13:23:58,721 INFO  [JMXConnector] starting JMXConnector on host 127.0.0.1:1090
                    13:23:59,596 INFO  [MailService] Mail Service bound to java:/Mail
                    13:24:00,549 信息    [HornetQServerImpl] live server is starting..
                    13:24:00,612 INFO  [JournalStorageManager] Using NIO Journal
                    13:24:00,674 警告    [HornetQServerImpl] Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.
                    13:24:03,784 INFO  [NettyAcceptor] Started Netty Acceptor version 3.2.0.BETA1-r2215 127.0.0.1:5445
                    13:24:03,784 INFO  [NettyAcceptor] Started Netty Acceptor version 3.2.0.BETA1-r2215 127.0.0.1:5455
                    13:24:03,784 信息    [HornetQServerImpl] HornetQ Server version 2.1.0.BETA3 (Hungry Hornet, 117) started
                    13:24:03,878 INFO  [WebService] Using RMI server codebase: http://127.0.0.1:8083/
                    13:24:05,003 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jdk1.6.0_18\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Oracle\bin;C:\WINDOWS\system3
                    13:24:05,159 INFO  [TomcatDeployment] deploy, ctxPath=/invoker
                    13:24:06,112 INFO  [RARDeployment] Required license terms exist, view vfs:/E:/jboss-6.0.0-M3/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
                    13:24:06,128 INFO  [RARDeployment] Required license terms exist, view vfs:/E:/jboss-6.0.0-M3/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
                    13:24:06,143 INFO  [RARDeployment] Required license terms exist, view vfs:/E:/jboss-6.0.0-M3/server/default/deploy/jms-ra.rar/META-INF/ra.xml
                    13:24:06,159 INFO  [HornetQResourceAdapter] HornetQ resource adaptor started
                    13:24:06,159 INFO  [RARDeployment] Required license terms exist, view vfs:/E:/jboss-6.0.0-M3/server/default/deploy/mail-ra.rar/META-INF/ra.xml
                    13:24:06,190 INFO  [RARDeployment] Required license terms exist, view vfs:/E:/jboss-6.0.0-M3/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
                    13:24:06,284 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: Thread-2
                    13:24:06,315 INFO  [SchedulerSignalerImpl] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
                    13:24:06,315 INFO  [QuartzScheduler] Quartz Scheduler v.1.7.3 created.
                    13:24:06,315 INFO  [RAMJobStore] RAMJobStore initialized.
                    13:24:06,315 INFO  [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
                    13:24:06,315 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.7.3
                    13:24:06,315 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
                    13:24:06,893 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
                    13:24:06,940 INFO  [UpdateChecker] New update(s) found: 1.8.0 [http://www.terracotta.org/kit/reflector?kitID=default&pageID=QuartzChangeLog]
                    13:24:07,346 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
                    13:24:07,409 INFO  [xnio] XNIO Version 2.1.0.CR2
                    13:24:07,409 INFO  [nio] XNIO NIO Implementation Version 2.1.0.CR2
                    13:24:07,674 INFO  [remoting] JBoss Remoting version 3.1.0.Beta2
                    13:24:07,768 INFO  [TomcatDeployment] deploy, ctxPath=/
                    13:24:07,956 INFO  [TomcatDeployment] deploy, ctxPath=/test
                    13:24:08,065 WARN  [JBossContextConfig] Failed to setup clustering, clustering disabled. ClusteringNotSupportedException: Could not access CacheManager for JBossWeb clustering
                    13:24:08,128 ERROR [STDERR] log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).
                    13:24:08,128 ERROR [STDERR] log4j:WARN Please initialize the log4j system properly.
                    13:24:08,159 警告    [JMSServerManagerImpl] Binding for /ConnectionFactory already exists
                    13:24:08,206 信息    [service] Removing bootstrap log handlers
                    13:24:08,253 INFO  [org.jboss.system.server.profileservice.ProfileServiceBootstrap] Loading profile: ProfileKey@1286929[domain=default, server=default, name=default]
                    13:24:08,315 INFO  [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8180
                    13:24:08,315 INFO  [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
                    13:24:08,315 INFO  [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.0.0.20100429-M3 "Neo"] Started in 1m:1s:94ms

                    • 7. Re: Can not receive JMS message in JBoss AS 6.0.0.M3
                      jaikiran

                      The logs don't show anything about the queue being deployed. Are you sure the queue is deployed? How are you deploying it?

                       

                      Also post the output of

                       

                      jar -tf test.jar

                       

                      And also the code of your MDB (including the import statements).

                      • 8. Re: Can not receive JMS message in JBoss AS 6.0.0.M3
                        jaikiran

                        jaikiran pai wrote:

                         

                        The logs don't show anything about the queue being deployed. Are you sure the queue is deployed?

                        Just booted my local M3 and looks like the queue deployment log messages are no longer logged. So those logs weren't useful after all. Do you have a simple application which can reproduce this? If yes, then please attach it here (including the client)

                        • 9. Re: Can not receive JMS message in JBoss AS 6.0.0.M3

                          Thank you jaikira,

                           

                          I find the reason. I have jboss.xml and ejb-jar.xml in my ear.  So there is no error log and the MessageListener is not init when JBoss started.

                          I remove these files in my ear.

                           

                          Thanks!