[jboss-user] JMS Bridge - JBoss 7.2 (HornetQ 2.3.0.RC1) + Artemis 2.4.0

acefael ese at acefael.es
Sat Jun 9 16:38:04 EDT 2018


hi

It's working now.  I had the InitialContext factory class name wrong.

since the internet does not seem to be helpful with complete examples
on subjects like this, I would like to give one here.

Forwarding from JBoss 7.2 to Artemis 2.4.0 via JMS Bridge:

- Setup JBoss Messaging as they say in the manual.  The manual is
  actually rather good here, so who am I to deprive you of the
  pleasure.

- Setup Artemis.  As before, the manual is extensive on the matter.

- Make an Artemis module for JBoss.  The module.xml file looks like that:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.activemq.artemis">
  <resources>
    <resource-root path="artemis-jms-client-all-2.4.0.jar" />
  </resources>

  <dependencies>
    <module name="sun.jdk" />
    <module name="javax.api"/>
    <module name="javaee.api"/>
    <module name="org.hornetq"/>
    <module name="org.jboss.as.messaging"/>
    <module name="org.jboss.as.naming"/>
    <module name="org.jboss.jboss-transaction-spi"/>
    <module name="org.jboss.jts"/>
    <module name="org.jboss.logging"/>
    <module name="org.jboss.netty"/>
  </dependencies>
</module>

The file goes as module.xml in
jboss/modules/org/activemq/artemis/main.  There you also copy
artemis-jms-client-all...jar.

There may be more JBoss module dependencies than actually needed, but
I could not find documentation on which modules are there and what
they provide.

- configure the JMS Bridge in standalone.xml:

<subsystem xmlns="urn:jboss:domain:messaging:1.3">
  <hornetq-server>
    ... your config here
  </hornetq-server>
  <jms-bridge name="artemis-bridge" module="org.activemq.artemis">
    <source>
      <connection-factory name="java:/ConnectionFactory"/>
      <destination name="/jms/queue/out"/>
    </source>
    <target>
      <connection-factory name="CF"/>
      <destination name="testQueue"/>
      <user>username</user>
      <password>password</password>
      <context>
        <property key="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
        <property key="java.naming.provider.url" value="tcp://127.0.0.1:61616?retryInterval=60000&amp;reconnectAttempts=-1"/>
        <property key="connectionFactory.CF" value="tcp://127.0.0.1:61616?retryInterval=60000&amp;reconnectAttempts=-1" />
        <property key="queue.testQueue" value="testQueue" />
      </context>
    </target>
    <quality-of-service>AT_MOST_ONCE</quality-of-service>
    <failure-retry-interval>500</failure-retry-interval>
    <max-retries>1</max-retries>
    <max-batch-size>500</max-batch-size>
    <max-batch-time>500</max-batch-time>
    <add-messageID-in-header>true</add-messageID-in-header>
  </jms-bridge>
</subsystem>

The Parameters of the ActiveMQInitialContextFactory are well described
in the Artemis docs.  There may be a little redundancy with the
repeatet tcp:// thingy.

And this is it.

Thanks
acefael

On Sat, Jun 09, 2018 at 09:44:05AM +0200, acefael wrote:
> hi
>
> I am trying to setup a JMS Bridge between JBoss 7.2 and Artemis 2.4. There is an error instantiating org.apache.activemq.artemis.jndi.ActiveMQInitialConnectionFactory, but there is not much detail.  Probably I am doing something wrong.  Does anyone know how to get more error detail out of JBoss ?
>
> This bridge uses a module I built myself from artemis jars.  When I add the jetty-all jar from Artemis to the module, the error changes. Then it seems to try to use the InitialContext from Jetty, because jetty-jndi has JNDI 'stuff' in it as well.  I am guessing I should make my module use 'JBoss Naming', but how?
>
> thanks
>
> 22:17:12 WARN  (ServerService Thread Pool -- 50) org.hornetq.jms.server HQ122012: Failed to connect JMS Bridge: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.apache.activemq.artemis.jndi.ActiveMQInitialConnectionFactory from classloader ModuleClassLoader for Module "org.activemq.artemis:main" from local module loader @74960bfa (finder: local module finder @42721fe (roots: C:\me\p\jboss-as-7.2.0.Final\modules,C:\me\p\jboss-as-7.2.0.Final\modules\system\layers\base))
> at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64) [jboss-as-naming-7.2.0.Final.jar:7.2.0.Final]
> at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681) [rt.jar:1.8.0_162]
> at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) [rt.jar:1.8.0_162]
> at javax.naming.InitialContext.init(InitialContext.java:244) [rt.jar:1.8.0_162]
> at javax.naming.InitialContext.<init>(InitialContext.java:216) [rt.jar:1.8.0_162]
> at org.hornetq.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:55) [hornetq-jms-server-2.3.0.CR1.jar:]
> at org.hornetq.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:40) [hornetq-jms-server-2.3.0.CR1.jar:]
> at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1144) [hornetq-jms-server-2.3.0.CR1.jar:]
> at org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:353) [hornetq-jms-server-2.3.0.CR1.jar:]
> at org.jboss.as.messaging.jms.bridge.JMSBridgeService.startBridge(JMSBridgeService.java:99) [jboss-as-messaging-7.2.0.Final.jar:7.2.0.Final]
> at org.jboss.as.messaging.jms.bridge.JMSBridgeService$1.run(JMSBridgeService.java:78) [jboss-as-messaging-7.2.0.Final.jar:7.2.0.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_162]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_162]
> at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_162]
> at org.jboss.threads.JBossThread.run(JBossThread.java:122)
> _______________________________________________
> jboss-user mailing list
> jboss-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-user


More information about the jboss-user mailing list