4 Replies Latest reply on May 21, 2012 10:57 AM by Justin Bertram

    Spring - HornetQ - JNDI

    Ramakrishna c Ch Newbie

      Hi All,

       

      I am new to this forum. So, let me thank you all for the lots of info provided.

       

      But still I am not able to find a decent article that describes JBoss AS 7(7.1.1 Final- I am using this) and Active MQ (I tried all sorts of snapshots of activemq-rar.rar)integration. So, I gave up on this and trying to live with HornetQ.

       

      I am using spring JMS Template and jms-listener. I am using the JNDI lookup for the hornetQ Queue that I created.

       

      Here are the code snippets

       

      From the standalone-full.xml

       

      <jms-queue name="myQueue">

       

                              <entry name="queue/myQueue"/>

       

                              <entry name="java:jboss/exported/jms/queue/myQueue"/>

       

                           </jms-queue>

       

      My spring bean for listener is

       

      <jms:listener-container connection-factory="jmsFactory2"

       

              destination-type="queue">

       

              <jms:listener destination="myQueue2" ref="baseMQConsumer"

       

                  method="handleMessage" />

       

          </jms:listener-container>

       

      and my jndi bean is

       

      <jee:jndi-lookup id="myQueue2" jndi-name="java:jboss/exported/jms/queue/myQueue"/>

       

      Now my log is this:

       

      16:55:49,823 WARN  [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-172) Setup of JMS message listener invoker failed for destination 'myQueue2' - trying to recover. Cause: There is no queue with name myQueue2

       

      16:55:49,823 INFO  [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-172) Successfully refreshed JMS Connection

       

      Any Help in this regard is much appreciated.

        • 1. Re: Spring - HornetQ - JNDI
          Andy Taylor Master

          So, I gave up on this and trying to live with HornetQ

          What do you mean 'live with' sounds like you would rather not use HornetQ!

           

          anyway, regarding your error you dont actually have a queue called 'myQueue2' configured.

          • 2. Re: Spring - HornetQ - JNDI
            Ramakrishna c Ch Newbie

            Hi Andy,

            I mean, the user should have a choice of being able to use what ever JMS impl he wants. I have used jboss 5 and was very happy with that.. coz i was able to go with my choice and now.. seems like i am tied to the default HQ. I do agree that HQ is better but still there should be a choice.

             

            Actually, I have the 'myQueue2' setup as jndi.. I am confident its working because I tried with a test servlet and I am able to post messaged to that and receive them.

             

            But if possible some one like you who is senior member provide a step by step guide for people like me who would want to use active mq would be of great help. I followed this:https://blog.coffeebeans.at/?p=230 and was still having problems to make it run smoothly.

             

            Actually, I am also parallelly looking into see if that could be coz of spring.

             

            And again I request andy or anyone to please provide a way to integrate AMQ.

             

            Thanks

            • 3. Re: Spring - HornetQ - JNDI
              Andy Taylor Master

              I mean, the user should have a choice of being able to use what ever JMS impl he wants. I have used jboss 5 and was very happy with that.. coz i was able to go with my choice and now.. seems like i am tied to the default HQ. I do agree that HQ is better but still there should be a choice.

              I agree, butthats really down to the JMS vendor to provide the proper integration layers and documentation.

               

              Actually, I have the 'myQueue2' setup as jndi.. I am confident its working because I tried with a test servlet and I am able to post messaged to that and receive them.

              Ok, I was just looking at the HQ part of the config which is where we add the component to JNDI, I'm not sure how all the jndi bean stuff works, its not really a HornetQ issue.

              But if possible some one like you who is senior member provide a step by step guide for people like me who would want to use active mq would be of great help. I followed this:https://blog.coffeebeans.at/?p=230 and was still having problems to make it run smoothly.

              Im not sure why as a HornetQ dev i would want to demonstrate how to use another vendors messaging system, thats really for the active mq guys to do. i would check how DefaultMessageListenerContainer looks up the queue.

               

               

              Anyway, this looks like a spring issue to me

              • 4. Re: Spring - HornetQ - JNDI
                Justin Bertram Master

                I mean, the user should have a choice of being able to use what ever JMS impl he wants. I have used jboss 5 and was very happy with that.. coz i was able to go with my choice and now.. seems like i am tied to the default HQ. I do agree that HQ is better but still there should be a choice.

                JBoss AS is, of course, 100% open source so you always have a choice about how things work.  Nearly all the functionality of the server is based on "subsystems".  There is a "messaging" subsystem which is basically a wrapper for HornetQ, but a JMS vendor (or you) could easily write a new subsystem to accommodate a different JMS implementation.  In previous versions of JBoss AS the integration point was an MBean which was convenient, but could be difficult to manage and usually forced configuration details to be mixed with implementation details (e.g. class-names of MBeans, etc.).  As I'm sure you know, JBoss AS7 is very different.  The subsystem approach allows tight integration with our management model (exposed via XML file, command line interface, HTTP, etc.) and improves overall usability.  That said, one is not forced to take this approach.  One may choose to deploy an MBean, but it won't be tied into the management model.

                 

                I read through http://activemq.apache.org/integrating-apache-activemq-with-jboss.html and it appears to me that the ActiveMQ integration with previous versions of JBoss AS was actually done through their JCA RA - a novel approach.  In theory, this approach could work with AS7 as is.  I think the main catch would be classloading because things are much tighter in AS7 than previously when we had a universal classloader.  Unfortunately I don't have time to test it out, though.

                 

                Regarding your actual problem, I agree with Andy that this appears to be a Spring problem.  If your servlet can find and use "myQueue2" then why can't the JMS listener?