13 Replies Latest reply on Apr 7, 2013 9:58 PM by jbertram

    EAP 6.1.0 MDB error

    ohmygod

      I am using EAP 6.1.0 and I am seeing this kind of error when sending message to MDB.  This problem only happens when there are a lot of messages processing at the same time. It works well when only there is small number of requests processing. Anybody knows why this error happens? It worked well in JBoss 7.1.1.Final version. I just upgraded my server to EAP 6.1.0.

       

      2013-03-29 16:37:23,705;[Thread-82 (HornetQ-client-global-threads-2070273556)];ERROR;org.jboss.as.ejb3.invocation;JBAS014134: EJB Invocation failed on component DemoMDB for method public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message): javax.ejb.EJBException: JBAS014517: Acquire semaphore was interrupted
                at org.jboss.as.ejb3.pool.strictmax.StrictMaxPool.get(StrictMaxPool.java:111)
                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:47)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:65)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:196)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
                at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
                at javax.jms.MessageListener$$$view45.onMessage(Unknown Source)
                at sun.reflect.GeneratedMethodAccessor947.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140)
                at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73)
                at $Proxy14.onMessage(Unknown Source)
                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:313)
                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1016)
                at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:52)
                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1161)
                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
                at java.lang.Thread.run(Thread.java:619)
      
      
      2013-03-29 16:37:23,756;[Thread-82 (HornetQ-client-global-threads-2070273556)];ERROR;org.hornetq.ra;HQ154005: Failed to deliver message: javax.ejb.EJBException: JBAS014517: Acquire semaphore was interrupted
                at org.jboss.as.ejb3.pool.strictmax.StrictMaxPool.get(StrictMaxPool.java:111)
                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:47)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:65)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:196)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
                at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
                at javax.jms.MessageListener$$$view45.onMessage(Unknown Source)
                at sun.reflect.GeneratedMethodAccessor947.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140)
                at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73)
                at $Proxy14.onMessage(Unknown Source)
                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:313)
                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1016)
                at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:52)
                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1161)
                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
                at java.lang.Thread.run(Thread.java:619)
      
      
      
      
      
        • 1. Re: EAP 6.1.0 MDB error
          jbertram

          My guess is that your maxSession is larger than the number of MDBs available in your (StrictMax) instance pool so when the message volume increases there simply aren't enough instances to keep up with the sessions processing the messages.

          • 2. Re: EAP 6.1.0 MDB error
            ohmygod

            Thanks Justin, can you please advise where to change the maxSession or the instance pool value in the configuration?

            • 3. Re: EAP 6.1.0 MDB error
              ohmygod

              I have seen this configuration in standalone.xml

               

               

              <bean-instance-pools>
                                  <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                                  <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
              </bean-instance-pools>
              
              

               

              but I didnot touch this in 7.1.1 version and there was no such problem. Please advise.

              • 4. Re: EAP 6.1.0 MDB error
                jbertram

                Since my guess didn't seem to be panning out I actually went and looked at the source code, and what I guessed was happening doesn't appear to actually be happening.  Instead, it appears that something is interrupting the call to java.util.concurrent.Semaphore.tryAcquire(long, TimeUnit) - like the error message indicates.  My hunch is that something is calling java.lang.Thread.interrupt() on this thread somewhere along the way, but I have no idea where.  Does your MDB make any calls to Thread.interrupt()? 

                 

                I've had luck using Byteman in the past to track down rogue interruptions before by intercepting and printing details about every call to Thread.interrupt().  Byteman is a wonderful tool in situations like this, and the script should be pretty simple for this particular use-case.

                • 5. Re: EAP 6.1.0 MDB error
                  ohmygod

                  I can be sure that there is no any place calling Thread.interrupt() in the code. The strange thing is I increased the "max-pool-size" to 100 and now I am not seeing this error any more. Do not know why. BTW, is there any side-effect if I increase the "max-pool-size" to a much bigger value?

                  • 6. Re: EAP 6.1.0 MDB error
                    jbertram

                    I can be sure that there is no any place calling Thread.interrupt() in the code.

                    If that's the case then a Byteman script would be useful.

                     

                     

                    The strange thing is I increased the "max-pool-size" to 100 and now I am not seeing this error any more. Do not know why.

                    No, I don't know why.

                     

                     

                    BTW, is there any side-effect if I increase the "max-pool-size" to a much bigger value?

                    I'm not aware of any side-effect.

                     

                     

                    Do you have a test-case you can provide me which reliably reproduces the problem?

                    • 7. Re: EAP 6.1.0 MDB error
                      ohmygod

                      Also met with such error message. It seems relating to interuput again. There is no special case. Just sending a lot of messages at the same time.

                       

                      2013-04-02 13:16:11,582;[Thread-115 (HornetQ-client-global-threads-1511848790)];ERROR;com.demo.FileSystemDemoMDB;Problem handling JMS message: javax.jms.JMSException: Failed to create session factory
                                at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:587)
                                at org.hornetq.jms.client.HornetQConnectionFactory.createQueueConnection(HornetQConnectionFactory.java:119)
                                at org.hornetq.jms.client.HornetQConnectionFactory.createQueueConnection(HornetQConnectionFactory.java:114)
                                at com.demo.DemoMDB.onMessage(DemoMDB.java:182)
                                at sun.reflect.GeneratedMethodAccessor361.invoke(Unknown Source)
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                at java.lang.reflect.Method.invoke(Method.java:597)
                                at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
                                at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
                                at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:104)
                                at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                                at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:65)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:196)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
                                at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                                at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
                                at javax.jms.MessageListener$$$view43.onMessage(Unknown Source)
                                at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                at java.lang.reflect.Method.invoke(Method.java:597)
                                at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140)
                                at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73)
                                at $Proxy14.onMessage(Unknown Source)
                                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:313)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1016)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:52)
                                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1161)
                                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
                                at java.lang.Thread.run(Thread.java:619)
                      Caused by: org.hornetq.api.core.HornetQInterruptedException: java.lang.InterruptedException
                                at org.hornetq.core.remoting.impl.netty.NettyConnection.write(NettyConnection.java:244)
                                at org.hornetq.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:268)
                                at org.hornetq.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:195)
                                at org.hornetq.core.client.impl.ClientSessionFactoryImpl$PingRunnable.send(ClientSessionFactoryImpl.java:1767)
                                at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1371)
                                at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:1071)
                                at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:246)
                                at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:826)
                                at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:583)
                                ... 61 more
                      Caused by: java.lang.InterruptedException
                                at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1215)
                                at java.util.concurrent.Semaphore.acquire(Semaphore.java:286)
                                at org.hornetq.core.remoting.impl.netty.NettyConnection.write(NettyConnection.java:175)
                      
                      
                      
                      • 8. Re: EAP 6.1.0 MDB error
                        ohmygod

                        Or can you suggest a standard piece of code to create and send out a JMS message in 6.1.0 version? I donot know if my code of sending JMS message has problems or not. Please advise.

                         

                        private QueueConnectionFactory m_queueConnectionFactory;
                        private InitialContext m_initialContext;
                        
                        public void ejbCreate()
                        {
                        m_initialContext = new InitialContext();
                        m_queueConnectionFactory = (QueueConnectionFactory) m_initialContext
                                            .lookup(JmsHelper.JMS_QUEUE_FACTORY_NAME);
                        }
                        
                        public void sendMsg()
                        {
                        
                        QueueConnection queueConnection = m_queueConnectionFactory.createQueueConnection();
                        queueConnection.start();
                        
                        QueueSession session = queueConnection.createQueueSession(false,
                                            Session.AUTO_ACKNOWLEDGE);
                        Queue queue = (Queue) m_initialContext.lookup("jmsName");
                        QueueSender sender = session.createSender(queue);
                        ObjectMessage om = session.createObjectMessage(myMessageObject);
                        sender.send(om);
                        
                        }
                        
                        

                         

                        The simple case is I am invoking sendMsg() in a loop (more than 100 times or so), and sometimes I can see that error message in the log.

                        • 9. Re: EAP 6.1.0 MDB error
                          jbertram

                          A few suggestions:

                           

                          1. Make sure you're using the JmsXA connection factory since it is pooled.
                          2. Don't invoke javax.jms.Connection.start().  That's only needed for consumers, not producers.
                          3. Close the connection in a finally block.
                          4. Avoid javax.jms.ObjectMessage if you can as it uses standard Java serialization which is fairly slow.
                          5. Test using javax.jms.Session.createQueue(String) instead of doing another JNDI lookup for the queue.  It's less portable but it's also likely faster, and that appears relevant here since you're executing this code so frequently.

                           

                          Aside from that I would strongly encourage you to use Byteman to track down the origin of the interrupt.  It really shouldn't be very difficult.

                          1 of 1 people found this helpful
                          • 10. Re: EAP 6.1.0 MDB error
                            ohmygod

                            Hi Justin, much appreciated for your suggestions.

                             

                            3. Do the session and sender object need to be closed in a finally block as well?

                             

                            4. I am not sure how to avoid using javax.jms.ObjectMessage. Do you mean using javax.jms.Session.createTextMessage() instead? But I am having an object that contains some hashMaps that need to pass between the MDBs. Can this be done?


                            5. I tried to use javax.jms.Session.createQueue(String) instead of doing another JNDI lookup for the queue, but it seems not working. Can you advise?

                             

                            2013-04-03 11:02:04,012;[Thread-189];ERROR;com.demo.DemoHandler;Test failed.: javax.jms.JMSException: There is no queue with name queue/demoQueue
                                           at org.hornetq.jms.client.HornetQSession.createQueue(HornetQSession.java:402)
                                           at org.hornetq.ra.HornetQRASession.createQueue(HornetQRASession.java:860)
                            
                            
                            

                             

                            The jms queue configuration is

                             

                             

                            <jms-queue name="demoQueue">
                                                    <entry name="queue/demoQueue"/>
                            </jms-queue>
                            
                            

                             

                            (Just tried with javax.jms.Session.createQueue("demoQueue") and it works. But what is the entry element used for?)

                             

                            And can you give me an instruction link or some site that shows how to use Byteman?

                             

                            Appreciated again for what you have done for me

                            • 11. Re: EAP 6.1.0 MDB error
                              jbertram

                              3. Do the session and sender object need to be closed in a finally block as well?

                              Closing the connection implicitly takes care of closing any child objects (e.g. session, producer, etc.).

                               

                               

                              4. I am not sure how to avoid using javax.jms.ObjectMessage. Do you mean using javax.jms.Session.createTextMessage() instead? But I am having an object that contains some hashMaps that need to pass between the MDBs. Can this be done?

                              If all you need to do is pass HashMaps then use a javax.jms.MapMessage.

                               

                               

                              5. I tried to use javax.jms.Session.createQueue(String) instead of doing another JNDI lookup for the queue, but it seems not working. Can you advise?

                              The value passed to createQueue(String) is not the JNDI name of the destination.  It is the "JMS provider specific name" as described in section 11.2.21 of the JMS 1.1 specification.  In your case it would be "demoQueue".

                               

                               

                              (Just tried with javax.jms.Session.createQueue("demoQueue") and it works. But what is the entry element used for?)

                              If you don't look up the destination via JNDI then the "entry" element(s) are not used for anything.

                               

                               

                              And can you give me an instruction link or some site that shows how to use Byteman?

                              Was the link I provided previously not suitable?  If so, please elaborate.

                              1 of 1 people found this helpful
                              • 12. Re: EAP 6.1.0 MDB error
                                ohmygod

                                Thanks Justin. Please ignore the byteman for now. I have read the user manual of HornetQ and found there is method to create connection factory directly using API instead of using JNDI.

                                 

                                The code is mostly like

                                 

                                TransportConfiguration transportConfiguration = 
                                                     new TransportConfiguration(NettyConnectorFactory.class.getName());                
                                ConnectionFactory cf = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,transportConfiguration);
                                
                                Queue demoQueue= HornetQJMSClient.createQueue("demoQueue");
                                
                                Connection connection = cf.createConnection();
                                
                                Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                                
                                MessageProducer producer = session.createProducer(demoQueue);
                                
                                connection.start();
                                
                                TextMessage message = session.createTextMessage("This is a demo");
                                producer.send(message);
                                
                                

                                 

                                Do you know what the difference is between them and which one is better and suggested? Please advise.

                                • 13. Re: EAP 6.1.0 MDB error
                                  jbertram

                                  Using the HornetQ API will almost certainly be faster than using JNDI since you are instantiating the connection factory rather than going through a bunch of JNDI plumbing to look it up (especially if you are doing this from a remote client - that's 2 fewer network round-trips).  Of course, it's common to perform JNDI look-ups just once and cache the results so over the life-span of the application the speed-up could be statistically insignificant.

                                   

                                  That said, your code is now tied directly to the HornetQ API and therefore would not work with any other JMS vendor if you decided to port your application elsewhere.

                                   

                                  Which one you pick is up to you and your use-case.