0 Replies Latest reply on Feb 14, 2013 8:40 AM by bomc

    Send a message from JBoss AS7.1.1 to a remote standalone hornetq

    bomc Newbie

      hi all,

       

      i am trying to send a jms message from JBoss As7.1.1 (using the standalone-full configuration) to a standalone Hornetq 2.2.14. I have configured a topic in Hornetq and this works.

       

      I have added to the JBoss the hornetq-ra.rar in the deployments directory. Additional I have added "Dependencies: org.jboss.jboss-transaction-spi,org.jboss.netty" to the MANIFEST.MF of the resourceadapter.

       

      Next I have added the following to the standalone-full.xml:

       

                      <resource-adapter>

                          <archive>

                              hornetq-MOM1-ra.rar

                          </archive>

                          <connection-definitions>

                              <connection-definition class-name="org.hornetq.ra.HornetQRAManagedConnectionFactory" jndi-name="java:jboss/MOM1JmsXA" enabled="true" use-java-context="true" pool-name="MOM1JmsXA" use-ccm="true">

                                  <config-property name="ConnectionParameters">

                                      host=192.168.2.2;port=5445

                                  </config-property>

                                  <config-property name="SessionDefaultType">

                                      javax.jms.Topic

                                  </config-property>

                                  <config-property name="ConnectorClassName">

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

                                  </config-property>

                                  <security>

                                      <application/>

                                  </security>

                                  <validation>

                                      <background-validation>false</background-validation>

                                      <use-fast-fail>false</use-fast-fail>

                                  </validation>

                              </connection-definition>

                          </connection-definitions>

                      </resource-adapter>

       

      This deploys fine, the console logs the JCA ConnectionFactory is registered java:jboss/MOM1JmsXA.

       

      In my EJB I invoke the following code to send a message:

       

       


      /**

      * Connection Factory JNDI name.

      */

      private final static String JMS_FACTORY = "java:jboss/MOM1JmsXA";

      /**

      * The remote connectionFactory.

      */

      @Resource(lookup = JMS_FACTORY)

      private ConnectionFactory connectionFactory;

      /**

      * The remote topicName.

      */

      private final static String TOPIC_NAME = "sms2any.Sms_Gateway_Topic";



      public void sendMessageToHornetq() {


      Connection connection = null;


      Session session = null;





      try {



      Topic topic = HornetQJMSClient.createTopic(TOPIC_NAME);



      connection = connectionFactory.createConnection();



      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);



      TextMessage textMessage = session.createTextMessage("bomc");



      final MessageProducer messageProducer = session.createProducer(topic);



      messageProducer.send(textMessage);


      } catch (JMSException e) {



      // TODO Auto-generated catch block



      e.printStackTrace();


      } finally {



      if(connection != null) {




      try {





      connection.close();




      } catch (JMSException e) {





      // Ignore




      }



      }


      }

      }

       

       

      I get the following error:

       

      14:33:06,172 ERROR [stderr] (EJB default - 1) javax.jms.InvalidDestinationException: Not a HornetQ Destination:HornetQTopic[sms2any.Sms_Gateway_Topic]

       

      14:33:06,173 ERROR [stderr] (EJB default - 1)           at org.hornetq.jms.client.HornetQSession.createProducer(HornetQSession.java:324)

       

      14:33:06,174 ERROR [stderr] (EJB default - 1)           at org.hornetq.ra.HornetQRASession.createProducer(HornetQRASession.java:1163)

       

      14:33:06,175 ERROR [stderr] (EJB default - 1)           at net.atos.gems.jms.Hornetq_2_1_2_SenderBean.scheduleJmsMessageToHornetq_2_1_2(Hornetq_2_1_2_SenderBean.java:80)

       

      14:33:06,176 ERROR [stderr] (EJB default - 1)           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       

      14:33:06,177 ERROR [stderr] (EJB default - 1)           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       

      14:33:06,178 ERROR [stderr] (EJB default - 1)           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       

      14:33:06,178 ERROR [stderr] (EJB default - 1)           at java.lang.reflect.Method.invoke(Method.java:597)

       

      14:33:06,179 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

       

      14:33:06,180 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,181 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

       

      14:33:06,182 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:34)

       

      14:33:06,182 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,183 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)

       

      14:33:06,184 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.concurrency.ContainerManagedConcurrencyInterceptor.processInvocation(ContainerManagedConcurrencyInterceptor.java:104)

       

      14:33:06,185 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,185 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

       

      14:33:06,186 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,187 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

       

      14:33:06,187 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

       

      14:33:06,188 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,189 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:53)

       

      14:33:06,190 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,191 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)

       

      14:33:06,191 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)

       

      14:33:06,192 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)

       

      14:33:06,193 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,194 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

       

      14:33:06,195 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,196 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

       

      14:33:06,197 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,198 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43)

       

      14:33:06,198 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,199 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

       

      14:33:06,200 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

       

      14:33:06,201 ERROR [stderr] (EJB default - 1)           at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

       

      14:33:06,202 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.timerservice.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:101)

       

      14:33:06,202 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.timerservice.task.CalendarTimerTask.callTimeout(CalendarTimerTask.java:60)

       

      14:33:06,203 ERROR [stderr] (EJB default - 1)           at org.jboss.as.ejb3.timerservice.task.TimerTask.run(TimerTask.java:132)

       

      14:33:06,204 ERROR [stderr] (EJB default - 1)           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

       

      14:33:06,205 ERROR [stderr] (EJB default - 1)           at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

       

      14:33:06,205 ERROR [stderr] (EJB default - 1)           at java.util.concurrent.FutureTask.run(FutureTask.java:138)

       

      14:33:06,206 ERROR [stderr] (EJB default - 1)           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

       

      14:33:06,207 ERROR [stderr] (EJB default - 1)           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

       

      14:33:06,208 ERROR [stderr] (EJB default - 1)           at java.lang.Thread.run(Thread.java:662)

       

      14:33:06,209 ERROR [stderr] (EJB default - 1)           at org.jboss.threads.JBossThread.run(JBossThread.java:122)

       

      Whats wrong? Thanks for your help.