0
votes

I'm having problems with my MDB running in JBoss 5.1.2 connecting to a remote standalone HornetQ via JMS. I know the HornetQ is up and running fine as I can connect to it and place/view messages via HermesJMS. However, my actual app does not seem to be able to successfully connect to it.

Here's my @MessageDriven annotation:

@MessageDriven(
        messageListenerInterface = MessageListener.class,
        activationConfig = { 
            @ActivationConfigProperty( //type of destination we pull messages from
                    propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
            @ActivationConfigProperty( //which destination JNDI suffix we pull message from
                    propertyName = "destination", propertyValue = "queue/inputQueue"),
            @ActivationConfigProperty( //how many times to reattempt on service errors
                    propertyName = "dLQMaxResent", propertyValue = "1"),
            @ActivationConfigProperty( //how many seconds to try a reconnect when failure to connect to jms provider
                    propertyName = "reconnectInterval", propertyValue = "15"),
            @ActivationConfigProperty(
                    propertyName = "providerAdapterJNDI", propertyValue = "java:/RemoteJMSProvider")
         }
    )

Here's my configuration in my jms-ds.xml file:

   <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
      name="hornetq:service=MSProviderLoader,name=RemoteJMSProvider,server=remotehost">
    <attribute name="ProviderName">RemoteJMSProvider</attribute>
    <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
    <!-- The connection factory -->
    <attribute name="FactoryRef">/LocalHornetQConnectionFactory</attribute>
    <!-- The queue connection factory -->
    <attribute name="QueueFactoryRef">/LocalHornetQConnectionFactory</attribute>
    <!-- The topic factory -->
    <attribute name="TopicFactoryRef">/LocalHornetQConnectionFactory</attribute>
    <!-- Connect to JNDI on the host "the-remote-host-name" port 1099-->
    <attribute name="Properties">
       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
       java.naming.provider.url=IPADDRESS:1099
    </attribute>   </mbean>

I can view the RemoteJMSProvider in the JBoss jmx-console. Additionally, in JNDIView, I can see the JNDI name of the Remote JMS Provider. I can also see the jms.queue.inputQueue in the JMX console, though when I attempt to view messages on it, it says there are none, even though I know there are by viewing HermesJMS.

Finally, there are no exceptions in my application. It all appears to be running fine, but it never receives any messages. Even the HornetQ logs show that my IP address has connected, so I'm not sure why I can't read off of the queues:

[RMI TCP Connection(6)-10.3.78.123] 17:02:06,837 FINER [sun.rmi.transport.tcp]  RMI TCP Connection(6)-10.3.78.123: (port 1098) client using 10.3.78.123:0

Any ideas?

Here's my HornetQ (2.2.5) configuration information for reference.

hornetq-jms.xml:

   <connection-factory name="LocalHornetQConnectionFactory">
      <xa>true</xa>
      <connectors>
         <connector-ref connector-name="netty"/>
      </connectors>
      <entries>
         <entry name="/LocalHornetQConnectionFactory"/>
      </entries>

      <retry-interval>5000</retry-interval>
      <retry-interval-multiplier>1.0</retry-interval-multiplier>
      <reconnect-attempts>-1</reconnect-attempts>
      <failover-on-server-shutdown>true</failover-on-server-shutdown>
      <confirmation-window-size>1048576</confirmation-window-size>
   </connection-factory>


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

   <queue name="inputQueue">
      <entry name="/queue/inputQueue"/>
   </queue>
   <queue name="errorQueue">
      <entry name="/queue/errorQueue"/>
   </queue>
   <topic name="SAFEStorageAcknowledgement">
      <entry name="/topic/SAFEStorageAcknowledgement"/>
   </topic>
   <topic name="SAFEEvents">
      <entry name="/topic/SAFEEvents"/>
   </topic>

hornetq-configuration.xml:

   <address-settings>
      <!--default for catch all-->
      <address-setting match="#">
         <dead-letter-address>jms.queue.errorQueue</dead-letter-address>
         <expiry-address>jms.queue.errorQueue</expiry-address>
         <redelivery-delay>15000</redelivery-delay>
         <max-size-bytes>10485760</max-size-bytes>       
         <message-counter-history-day-limit>10</message-counter-history-day-limit>
         <address-full-policy>BLOCK</address-full-policy>
         <redistribution-delay>60000</redistribution-delay>
      </address-setting>
   </address-settings>

   <queues>
        <queue name="jms.queue.inputQueue">
            <address>jms.queue.inputQueue</address>
        </queue>

        <queue name="jms.queue.errorQueue">
            <address>jms.queue.errorQueue</address>
        </queue>

        <queue name="jms.queue.invalidQueue">
            <address>jms.queue.invalidQueue</address>
        </queue>

    </queues>

All other HornetQ settings are at default.

Thanks, Andy

1
Can you either accept the answer or tell me it didn't work please?Clebert Suconic

1 Answers

0
votes

You have to specify on either the ra.xml or as an annotation two activation properties:

ConnectorClassName = org.hornetq.core.remoting.impl.netty.NettyConnectorFactory

ConnectionParameters = host=127.0.0.1;port=5446

On the HornetQ distribution, there's an example called javaee/jca-remote which is using the ra.xml to configure the activation property.