5 Replies Latest reply: Jul 25, 2011 3:24 AM by Partha Sarathi Dash RSS

    org.springframework.jms.InvalidDestinationException: Not a HornetQ Destination:HornetQQueue

    Partha Sarathi Dash Newbie

      I'm getting an InvalidDestinationException whenever I'm trying to send a message from my spring bean to my honetQ MDB.

       

      I'm able to deploy my message sender web application successfully, it means the jndi lookup on startup works fine. But while sending the message from spring container to the MDB (deployed in JBOSS), it throws an InvalidDestinationException

       

      ANy idea?

       

      ExcaptionStack:

      org.springframework.jms.InvalidDestinationException: Not a HornetQ Destination:HornetQQueue[AUALoggerQueue]; nested exception is javax.jms.InvalidDestinationException: Not a HornetQ Destination:HornetQQueue[AUALoggerQueue]

              at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:285)

              at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)

              at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)

              at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:534)

              at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:526)

              at com.spark.loadrunner.jms.service.serviceImpl.AMQMsgSenderService.sendMessage(AMQMsgSenderService.java:31)

              at com.spark.loadrunner.jms.web.loadrunner.ProducerLoadRunnerController.amqLoadTest(ProducerLoadRunnerController.java:31)

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

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

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

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

              at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)

              at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)

              at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)

              at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)

              at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)

              at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)

              at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

              at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)

              at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)

              at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)

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

      Caused by: javax.jms.InvalidDestinationException: Not a HornetQ Destination:HornetQQueue[AUALoggerQueue]

              at org.hornetq.jms.client.HornetQSession.createProducer(HornetQSession.java:324)

              at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedProducer(CachingConnectionFactory.java:360)

              at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:320)

              at $Proxy13.createProducer(Unknown Source)

              at org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:971)

              at org.springframework.jms.core.JmsTemplate.createProducer(JmsTemplate.java:952)

              at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:563)

              at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:536)

              at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)

       

       

      My Spring configuration for JMS is as fallows

       

      <jee:jndi-lookup id="connectionFactory"

              jndi-name="/ConnectionFactory" cache="true"

              resource-ref="true" lookup-on-startup="true"

              expected-type=""

              proxy-interface="javax.jms.ConnectionFactory" >

              <jee:environment>

                    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

              </jee:environment>

          </jee:jndi-lookup>

         

       

          <jee:jndi-lookup id="fooQueue" jndi-name="/queue/AUALoggerQueue"

              cache="true" resource-ref="true" lookup-on-startup="true"

              proxy-interface="javax.jms.Queue" >

              <jee:environment>

                    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

              </jee:environment>

          </jee:jndi-lookup>

       

          <bean id="cachedConnectionFactory"

              class="org.springframework.jms.connection.CachingConnectionFactory"

              p:targetConnectionFactory-ref="connectionFactory" p:sessionCacheSize="10" />

       

          <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"

              p:connectionFactory-ref="cachedConnectionFactory"

              p:defaultDestination-ref="fooQueue" />

       

          <bean id="messageSenderService"

              class="com.spark.loadrunner.jms.service.serviceImpl.AMQMsgSenderService"

              p:jmsTemplate-ref="jmsTemplate" />

       

       

      In JBOSS + HornetQ the destination queue is defined as fallows

      <queue name="AUALoggerQueue">

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

      </queue>

       

      Attached files:

      jms-context.xml -- Spring JMS configuration file

      hornetq-jms.xml -- Destination queue defiend in JBOSS + HornetQ