Subscribed unsubscribe Subscribe Subscribe

igarashitm.log

igarashitm, a Japanese software engineer writes something in English here.

Connecting to HornetQ via remote JNDI provider

Today I have been trying to make my SwitchYard application connected to remote HornetQ, succeeded with following.

Add JNDI properties to the InitialContext

This piece is mentioned by Justin on this thread:
Accessing HornetQ using remote lookup via JNDI | Community

final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "remote://localhost:4447");
InitialContext ic = new InitialContext(env);
Add jboss-deployment-structure.xml into application.jar!/META-INF

This was the piece I've been looking for. org.jboss.naming.remote.client.InitialContextFactory is in the org.jboss.remote-naming module.

  • application.jar!/META-INF/jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
  <deployment>
    <dependencies>
      <module name="org.jboss.remote-naming" />
      <module name="org.hornetq" />
    </dependencies>
  </deployment>
</jboss-deployment-structure>


Once [SWITCHYARD-1712] JCA outbound cannot communicate with remote destinations/brokers - JBoss Issue Tracker is fixed, then SwitchYard JCA outbound should be able to connect to the HornetQ server via remote JNDI.