Results 1 to 8 of 8

Thread: Not a HornetQ Destination:HornetQQueue

Hybrid View

  1. #1

    Default Not a HornetQ Destination:HornetQQueue

    Hi there,

    I'm banging my head on this problem for a while now so thought I better ask this forum.

    I'm using JBoss AS 7.1.1 with full-ha configuration. I want to use HornetQ as my messaging server. I'm developing in Spring 3.1.2.

    I am experimenting with the testQueue as defined in standalone/configuration/standalone-full-ha.xml:

    Code:
    <jms-queue name="testQueue">
    
      <entry name="queue/test"/>
    
      <entry name="java:jboss/exported/jms/queue/test"/>
    
    </jms-queue>
    My Spring configuration is as follows:

    Code:
    <bean name="qConnectionFactory" class="org.hornetq.jms.client.HornetQXAConnectionFactory">
    
      <constructor-arg name="ha" value="true" />
    
      <constructor-arg>
    
        <bean name="transportConfiguration" class="org.hornetq.api.core.TransportConfiguration">
    
          <constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"/>
    
          <constructor-arg>
    
            <map key-type="java.lang.String" value-type="java.lang.Object">
    
              <entry key="host" value="localhost" />
    
              <entry key="port" value="5445" />
    
            </map>
    
          </constructor-arg>
    
        </bean>
    
      </constructor-arg>
    
    </bean>
    
    <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    
      <property name="environment">
    
        <props>
    
          <prop key="java.naming.factory.initial">org.jboss.as.naming.InitialContextFactory</prop>
    
          <prop key="java.naming.provider.url">remote://localhost:4447</prop>
    
          <prop key="java.naming.security.principal">user</prop>
    
          <prop key="java.naming.security.credentials">password</prop>
    
        </props>
    
      </property>
    
    </bean>
    
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    
      <property name="connectionFactory">
    
        <ref bean="qConnectionFactory"/>
    
      </property>
    
      <property name="destinationResolver">
    
        <bean class="org.springframework.jms.support.destination.JndiDestinationResolver"/>
    
      </property>
    
    </bean>
    
    <!-- A destination in JBoss/HornetQ -->
    
    <bean id="testQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
    
      <property name="jndiName">
    
        <value>java:jboss/exported/jms/queue/test</value>
    
      </property>
    
      <property name="jndiTemplate" ref="jndiTemplate"/>
    
    </bean>
    And in my code (Controller) I'm using jmsTemplate as follows:

    Code:
    @Autowired
    
    private JmsTemplate jmsTemplate;
    
     
    
    @Autowired
    
    private Destination testQueue;
    
    jmsTemplate.send(testQueue, new MessageCreator() {
    
      public Message createMessage(Session session)
    
        throws JMSException {
    
        Message message = session.createMessage();
    
        return message;
    
      }
    
    });
    When I try to send the message, I get the following JmsException:

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

    This is thrown from HornetQSession at:

    Code:
    public MessageProducer createProducer(final Destination destination) throws JMSException
    
      {
    
        if (destination != null && !(destination instanceof HornetQDestination))
    
        {
    
          throw new InvalidDestinationException("Not a HornetQ Destination:" + destination);
    
        }
    
        ...
    This method is expecting a HornetQDestination while Spring autowires a HornetQQueue.

    1) I'm not sure how Spring knows to autowire a HornetQQueue (although it should be a HornetQDestination, it is close!)

    2) It should autowire a HornetQDestination, right?

    Has anyone worked around this?

    Many thanks,

    Nes

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    HornetQDestination is an abstract class, and HornetQQueue is a concrete class that extends it. Therefore, that instanceof check should be fine. Are you actually seeing that check fail in the debugger?
    Last edited by Mark Fisher; Jul 21st, 2012 at 12:13 PM.

  3. #3

    Default

    Quote Originally Posted by Mark Fisher View Post
    HornetQDestination is an abstract class, and HornetQQueue is a concreted class that extends it. Therefore, that instanceof check should be fine. Are you actually seeing that check fail in the debugger?
    Hi Mark,

    Yes, strange enough. That is how I traced it to that method. I double checked just now and my cursor is on the line:

    throw new InvalidDestinationException("Not a HornetQ Destination:" + destination);

    The passed in destination is:

    destination HornetQQueue (id=14724)
    address "jms.queue.testQueue" (id=14725)
    name "testQueue" (id=14726)
    queue true
    session null
    simpleAddress SimpleString (id=14727)
    temporary false


    Thanks.

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Can you verify that you don't have a classloading issue there (maybe parent vs. child loading)?

  5. #5

    Default

    Quote Originally Posted by Mark Fisher View Post
    Can you verify that you don't have a classloading issue there (maybe parent vs. child loading)?
    Will try. Not my strongest skill with different contexts in Spring/Web, and my application deployed as a WAR in JBoss I always struggle a bit to fully comprehend how every class gets loaded. Will investigate now.

  6. #6

    Default

    So my WAR has the client JARs:

    hornetq-core-client-2.2.13.Final.jar
    hornetq-jms-client-2.2.13.Final.jar

    and the server (JBoss AS 7.1.1) has:

    hornetq-core-2.2.13.Final
    hornetq-jms-2.2.13.Final

    I also had hornetq-core-2.2.13.Final in my WAR to get around these errors:

    22:35:10,659 ERROR [stderr] (http--127.0.0.1-8080-1) [ModuleClassLoader@557791] error can't determine implemented interfaces of missing type org.hornetq.core.security.HornetQPrincipal
    22:35:10,659 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving type org.hornetq.core.remoting.impl.netty.NettyConnecti on
    22:35:10,660 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving classes
    22:35:10,660 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving
    22:35:10,660 ERROR [stderr] (http--127.0.0.1-8080-1) [Xlint:cantFindType]
    22:35:10,661 ERROR [stderr] (http--127.0.0.1-8080-1) [ModuleClassLoader@557791] error can't determine implemented interfaces of missing type org.hornetq.core.security.HornetQPrincipal
    22:35:10,661 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving type org.hornetq.core.remoting.impl.netty.NettyConnecti on
    22:35:10,662 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving classes
    22:35:10,662 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving
    22:35:10,663 ERROR [stderr] (http--127.0.0.1-8080-1) [Xlint:cantFindType]
    22:35:10,670 ERROR [stderr] (http--127.0.0.1-8080-1) [ModuleClassLoader@557791] error can't determine implemented interfaces of missing type org.hornetq.core.security.HornetQPrincipal
    22:35:10,670 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving type org.hornetq.core.protocol.core.impl.RemotingConnec tionImpl
    22:35:10,671 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving classes
    22:35:10,671 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving
    22:35:10,671 ERROR [stderr] (http--127.0.0.1-8080-1) [Xlint:cantFindType]
    22:35:10,672 ERROR [stderr] (http--127.0.0.1-8080-1) [ModuleClassLoader@557791] error can't determine implemented interfaces of missing type org.hornetq.core.security.HornetQPrincipal
    22:35:10,676 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving type org.hornetq.core.protocol.core.impl.RemotingConnec tionImpl
    22:35:10,677 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving classes
    22:35:10,678 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving
    22:35:10,678 ERROR [stderr] (http--127.0.0.1-8080-1) [Xlint:cantFindType]
    22:35:10,746 ERROR [stderr] (http--127.0.0.1-8080-1) [ModuleClassLoader@557791] error can't determine implemented interfaces of missing type org.hornetq.core.paging.PagedMessage
    22:35:10,747 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving type org.hornetq.core.protocol.core.impl.wireformat.Rep licationPageWriteMessage
    22:35:10,748 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving classes
    22:35:10,748 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving
    22:35:10,748 ERROR [stderr] (http--127.0.0.1-8080-1) [Xlint:cantFindType]
    22:35:10,748 ERROR [stderr] (http--127.0.0.1-8080-1) [ModuleClassLoader@557791] error can't determine implemented interfaces of missing type org.hornetq.core.paging.PagedMessage
    22:35:10,749 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving type org.hornetq.core.protocol.core.impl.wireformat.Rep licationPageWriteMessage
    22:35:10,749 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving classes
    22:35:10,750 ERROR [stderr] (http--127.0.0.1-8080-1) when weaving
    22:35:10,750 ERROR [stderr] (http--127.0.0.1-8080-1) [Xlint:cantFindType]

    but I removed that JAR from my WAR for now (so the above errors do show up in the logs).

    I still see "Not a HornetQ Destination:HornetQQueue[testQueue];" in the logs.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •