11 Replies Latest reply on May 2, 2014 10:02 AM by Justin Bertram

    Arquillian JMS Test using HornetQ gets stuck

    Atul Wagle Newbie

      Hi,

       

      I am trying to write a very simple jms unit test using HornetQ and Arquillian. I am able to get connection to the queue. However, my test is not able to send a message to the MDB.

      I am not sure if my MDB is correctly registered to the queue.

       

      Can someone please take a look at my setup and see if something obvious is missing?

       

      I have never worked with message beans and arquillian. Any help/advice will be highly appreciated.

       

      Regards,

      Atul

        • 1. Re: Arquillian JMS Test using HornetQ gets stuck
          Yong Hao Gao Master

          Your MDB seems fine. If you can print out more debug info from InjectionTestCase it will perhaps help find out where the problem is. (Exception.txt doesn't give the line number where it fails)

           

          Howard

          • 2. Re: Arquillian JMS Test using HornetQ gets stuck
            Atul Wagle Newbie

            Hi Howard,

             

            Thanks a lot for the reply.

            The line it gets stuck is:   Message response = requestor.request(request);

            It is as if it cannot get hold of the MDB or it is waiting on some other port.

             

            BTW is my hornetQ config correct in the standalone.xml?

             

            Thanks,

            Atul

            • 3. Re: Arquillian JMS Test using HornetQ gets stuck
              Yong Hao Gao Master

              You just remind me that the pooled connection factory seems missing in standalone.xml:

               

                              <pooled-connection-factory name="hornetq-ra">
                                  <transaction mode="xa"/>
                                  <connectors>
                                      <connector-ref connector-name="in-vm"/>
                                  </connectors>
                                  <entries>
                                      <entry name="java:/JmsXA"/>
                                      <entry name="java:jboss/DefaultJMSConnectionFactory"/>
                                  </entries>
                              </pooled-connection-factory>

              I'm not familiar with Arquillian but if you run test in the AS container, you probably need to use this connection factory.

               

              Howard

              • 4. Re: Arquillian JMS Test using HornetQ gets stuck
                Yong Hao Gao Master

                and what do you mean by stuck? does it hang there? Maybe you can try first to test sending a message first (use producer, not the QueueRequestor) and see if the sending is ok.

                 

                Howard

                • 5. Re: Arquillian JMS Test using HornetQ gets stuck
                  Atul Wagle Newbie

                  Well as shown in server log file:

                   

                  17:04:25,922 INFO  [org.jboss.as.arquillian] (MSC service thread 1-15) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."test.jar",unit=test.jar,tests=[com.mycompany.InjectionTestCase]]

                  17:04:26,111 INFO  [org.jboss.as.server] (management-handler-thread - 3) JBAS018559: Deployed "test.jar"

                  <THIS IS WHERE THE TEST GETS STUCK>

                  17:05:19,077 DEBUG [org.apache.catalina.session.ManagerBase] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Start expire sessions StandardManager at 1398125119077 sessioncount 0

                  17:05:19,077 DEBUG [org.apache.catalina.session.ManagerBase] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) End expire sessions StandardManager processingTime 0 expired sessions: 0

                   

                  For like 50 secs or so the test just remains on the line : Message response = requestor.request(request);

                   

                  I am going to try this on a separate computer and see if it works. I will keep u posted. Thanks for looking into this issue.

                  • 6. Re: Arquillian JMS Test using HornetQ gets stuck
                    Justin Bertram Master

                    For like 50 secs or so the test just remains on the line : Message response = requestor.request(request);

                    Do you have a stack-trace for this thread?  It's likely down in the HornetQ implementation doing something which would be helpful to know.

                     

                    BTW, I recently updated all the Java EE examples that ship with HornetQ (which use Arquillian) to work with WildFly.  Maybe it would be helpful for you to take a look at one of those.  Just look at the master branch.

                    • 7. Re: Arquillian JMS Test using HornetQ gets stuck
                      Atul Wagle Newbie

                      Thanks for the reply Justin.

                      I got the latest examples from the github.

                      I have windows 64bit PC. I have installed 64-bit JDK.

                       

                      However, i am getting this exception while running these examples. Same issue happens while running javaee examples.

                       

                      I have set MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=1024m -XX:MaxDirectMemorySize=2048m

                       

                      How to fix this issue?

                       

                      NFO: HQ221001: HornetQ Server version 2.5.0.SNAPSHOT (Wild Hornet, 125) [ff4501f2-d153-11e3-bc60-051a85600506]

                      ay 01, 2014 10:14:06 AM org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1 run

                      RROR: HQ214017: Caught unexpected Throwable

                      ava.lang.OutOfMemoryError: Direct buffer memory

                             at java.nio.Bits.reserveMemory(Bits.java:658)

                             at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123)

                             at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:306)

                             at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:433)

                             at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:179)

                             at io.netty.buffer.PoolArena.allocate(PoolArena.java:168)

                             at io.netty.buffer.PoolArena.allocate(PoolArena.java:98)

                             at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:241)

                             at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:155)

                             at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:146)

                             at org.hornetq.core.remoting.impl.netty.PartialPooledByteBufAllocator.directBuffer(PartialPooledByteBufAllocator.java:102)

                             at org.hornetq.core.remoting.impl.netty.NettyServerConnection.createBuffer(NettyServerConnection.java:35)

                             at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.createBuffer(RemotingConnectionImpl.java:319)

                             at org.hornetq.core.protocol.core.impl.PacketImpl.encode(PacketImpl.java:251)

                             at org.hornetq.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:236)

                             at org.hornetq.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:206)

                             at org.hornetq.core.protocol.core.impl.CoreProtocolManager$LocalChannelHandler$3.run(CoreProtocolManager.java:326)

                             at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:104)

                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                             at java.lang.Thread.run(Thread.java:745)

                       

                      ava.lang.reflect.InvocationTargetException

                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                             at java.lang.reflect.Method.invoke(Method.java:606)

                             at org.hornetq.maven.HornetQClientPlugin.execute(HornetQClientPlugin.java:64)

                             at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)

                             at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)

                             at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

                             at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

                             at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)

                             at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)

                             at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)

                             at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)

                             at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)

                             at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)

                             at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)

                             at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)

                             at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)

                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                             at java.lang.reflect.Method.invoke(Method.java:606)

                             at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)

                             at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)

                             at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)

                             at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

                      aused by: java.lang.OutOfMemoryError: Direct buffer memory

                             at java.nio.Bits.reserveMemory(Bits.java:658)

                             at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123)

                             at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:306)

                             at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:433)

                             at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:179)

                             at io.netty.buffer.PoolArena.allocate(PoolArena.java:168)

                             at io.netty.buffer.PoolArena.allocate(PoolArena.java:98)

                             at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:241)

                             at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:155)

                             at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:146)

                             at org.hornetq.core.remoting.impl.netty.PartialPooledByteBufAllocator.directBuffer(PartialPooledByteBufAllocator.java:102)

                             at org.hornetq.core.remoting.impl.netty.NettyServerConnection.createBuffer(NettyServerConnection.java:35)

                             at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.createBuffer(RemotingConnectionImpl.java:319)

                             at org.hornetq.core.protocol.core.impl.PacketImpl.encode(PacketImpl.java:251)

                             at org.hornetq.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:236)

                             at org.hornetq.core.protocol.core.impl.ChannelImpl.sendAndFlush(ChannelImpl.java:201)

                             at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.disconnect(RemotingConnectionImpl.java:414)

                             at org.hornetq.core.remoting.server.impl.RemotingServiceImpl.freeze(RemotingServiceImpl.java:379)

                             at org.hornetq.core.server.impl.HornetQServerImpl.freezeConnections(HornetQServerImpl.java:905)

                             at org.hornetq.core.server.impl.HornetQServerImpl.stop(HornetQServerImpl.java:647)

                             at org.hornetq.core.server.impl.HornetQServerImpl.stop(HornetQServerImpl.java:579)

                             at org.hornetq.core.server.impl.HornetQServerImpl.stop(HornetQServerImpl.java:540)

                             at org.hornetq.jms.server.impl.JMSServerManagerImpl.stop(JMSServerManagerImpl.java:508)

                             at org.hornetq.jms.server.embedded.EmbeddedJMS.stop(EmbeddedJMS.java:121)

                             at org.hornetq.jms.example.EmbeddedExample.runExample(EmbeddedExample.java:121)

                             at org.hornetq.jms.example.EmbeddedExample.main(EmbeddedExample.java:52)

                             ... 26 more

                      • 8. Re: Arquillian JMS Test using HornetQ gets stuck
                        Justin Bertram Master

                        Can you be more specific about what steps you followed that resulted in this problem?  I just tried these steps on master:

                         

                        1. mvn -Prelease install
                        2. cd distribution/hornetq/target/hornetq-2.5.0-SNAPSHOT-bin/hornetq-2.5.0-SNAPSHOT/examples/javaee/mdb-bmt/
                        3. export JBOSS_HOME=/path/to/wildfly-8.0.0.Final/
                        4. mvn verify

                         

                        Everything worked fine.  The example ran and finished successfully.

                         

                        BTW, I'm on a 64-bit Linux box using a 64-bit version of Java 1.7.0_55.

                        • 9. Re: Arquillian JMS Test using HornetQ gets stuck
                          Justin Bertram Master

                          One more thing...You should be able to use the "javaVmArguments" property in the arquillian.xml for the test to specify additional memory if you really need it (although I think there's something else wrong here for you to get an OOME).

                          • 10. Re: Re: Arquillian JMS Test using HornetQ gets stuck
                            Atul Wagle Newbie

                            Earlier on I was using EAP 6.1 as that is what i have at work.

                            However, this time i used WildFly but the result is the same (it is not oome).

                            Even the mdb-cmt example had an error. I have log file for that.

                             

                            BTW are u using linux or windows box?

                            • 11. Re: Re: Arquillian JMS Test using HornetQ gets stuck
                              Justin Bertram Master

                              Your mdb_log.txt is interesting in that it doesn't look like WildFly is starting at all.  Compare that to my log (attached).  I'm not sure what's going on, and I don't have a Windows box handy to test it on.  As I said in my previous comment, I'm on Linux.