Wednesday, 13 January 2016

Install embedded in-memory ActiveMQ 5.11.1 broker with XA within your Weblogic 12c JVM


  1. Patch the ActiveMQ jars
  2. Patch Weblogic JMS jar
  3. Install the resource adapter into Weblogic 12c.
  4. Plugin runtime system parameters to enable JMX connection from the ActiveMQ console
  5. Deploy the ActiveMQ Console web app

1. Patch the ActiveMQ jars

Weblogic is expecting an ra.xml configuration file describing the resource adapter instantiation parameters and the connection factories definitions. The factories definitions included therein are abstract. They do not refer to any instantiation parameters.
The only instantiation parameters are those of the resource adapter described by the sequence of config-property elements
Download here a sample of a correct resource adapter configuration file.
Our factory definition have to include the following interfaces, classes :
  • managedconnectionfactory-class
  • connectionfactory-interface
  • connection-interface
  • connection-impl-clas

    The relative xml configuration looks like this:
             <managedconnectionfactory class>
 </outbound-resourceadapter >

The cascade of instantiation is better described by this class diagram (figure 1):


                                         <name>PhysicalName</name>                                                                                                        <value>MyEvent</value>

Download here a correct configuration of weblogic-ra.xml

2. Patch the Weblogic jar

Unfortunately the recovery of the connection destination carried out by the weblogic container casts for some reason the JMS destination to weblogic.jms.common.DestinationImpl. Hence, it prevents plugging in foreign broker into Weblogic.
To overcome this, it is up to you to inherit the ActiveMQDestination directly from the weblogic DestinationImpl.

I ended up with the following classes structure:

Figure 3

Create a jar file _patch.jar containing the mofied class weblogic.jms.common.DestinationImpl.
In the command bat file starting the managed server where ActiveMQ is going to be hosted, add the patch to the PRE_CLASSPATH:
SET ACTIVEMQ=[activeMQ directory]

Patch jar activemq-client-5.11.1.jar  with the modified class org.apache.activemq.jndi.JNDIBaseStorable

Make sure the jar inside the rar archive are copied again into the lib directory of the domain.

3. Install the resource adapter into Weblogic 12c.

Make sure both the resource adapter configuration files, ra.xml and weblogic-ra,xml  lie under META-INF. Deploy the rar archive as an application to Weblogic.

4. Plugin runtime system parameters to enable JMX connection from the ActiveMQ console

To enable JMX connection please input in the JVM startup the following parameters (this will added to the environment variable JAVA_OPTIONS)

To instruct the ActiveMQ console to which broker to connect to you need to set system properties into the JVM on which the web console in running. In our case, as we are dealing with in-memory broker, it is the same JVM of the same managed server the broker is running onto.
Hence we will add the following parameters to our JVM:

-Dwebconsole.type=properties -Dwebconsole.jms.url=vm://localhost -Dwebconsole.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:9010/jmxrmi (this will added to the environment variable JAVA_OPTIONS)

5. Deploy the ActiveMQ Console webapp

Deploy the activemq-web-console-5.11.1.war to the same Managed server where the in memory broker resides.

About Me

My Photo