How can I deploy resource adapter activation in JBoss 7?

I'm trying to figure out how to deploy resource adapter activation in JBoss 7. Basically, I want to be able to package and deploy a complete application without changing the underlying server configuration, partly because I want bootstrap using Arquillian, but also because I want to have the ability to deploy my packages in an environment where I may not be able to change the configuration of the underlying server.

Here is where I am now. I created an EAR that contains active-mq rar (which is also configured in application.xml). This ear itself builds and deploys nicely using the maven ear plugin and the jboss-as-maven plugin.

However, to activate rar, the only way I could figure out was to hack the rar file itself and add ironjacamar.xml to the rar META-INF . But for that I had to hack rar in my maven repo which I really don't want to do.

I tried to get maven to add ironjacamar.xml during the packaging phase of my maven pom, but that was a bit of a hack and I couldn't get it to work anyway. (Note to yourself: check Deployment Overlay )

I also thought about writing adding a factory connection using jboss-cli, but the docs clearly state that creating factories for the hornet-mq embedded server which is not my goal and swapping the default JMS implementation on the server requires some serious operation in the server configuration.

I went through all the quick start projects and found that all sorts of constructs are deployed using the -jms.xml and -ds.xml files included in the package, but these are also specific to hornet-mq and JDBC respectively. (I was hoping the deployer could support -rar.xml or the like).

The only other way I can think of, and I don't know if this is supported, is to define the subsystem deployment in my package. Is there such a thing?

===== UPDATE =====

I tried adding cli overlay update (as I would use maven jboss as plugin) but it had no effect.

deployment-overlay add --name=rarActivation  --content=META-INF/ironjacamar.xml=\..\container\src\main\resources\ironjacamar.xml --deployments=activemq-rar.rar --redeploy-affected

      

+2


source to share


1 answer


Well, in the absence of any other answers, this is the solution I came across. It's a bit of a hack, but it worked flawlessly with Active MQ and WebSphere MQ. The premise is that I am deploying 2 different RARs to the JMS system I want to connect to. One of them is the untouched xxx.rar file that I pull from the Maven repository. The second is my "config RAR" which contains a copy of the ra.xml from the original rar, followed by the ironjacamar.xml config file . Both are placed in the config rar META-INF folder .

For each given RAR provider, the ironjacamar.xml file can be generated using rar-info.sh , which is included in the Iron Jacamar 1.1 download. The procedure is described in section 10.1. Resource adapter information tool enter user guide .

Using ActiveMQ 5.8.0 as an example:

The generated ironjacamar.xml is extracted from the full output of rar-info.sh . Inside the file, it is called:

Deployment Descriptor:
----------------------

      

The discarded portion of the file, which will become ironjacamar.xml , starts after this header and ends with </ resource-adapters> .

The following changes should apply:

  • Remove open tags <resource-adapters>

    and <resource-adapter>

    and replace them with tag <ironjacamar.xml>

    .
  • Remove the opening tag <archive>

    .
  • Remove the closing tags </resource-adapter>

    and </resource-adapters>

    and replace with the closing tag </ironjacamar.xml>

    .

There are sample definitions for connection factories for each connection type (Connection, Queue and Topic) that include the JNDI name in which JBoss will link the factories. Edit them as you see fit. I only needed the factory connection, so I edited the JNDI name and removed the other two definitions.

There are example definitions for targeted links (which are practically unnecessary for ActiveMQ, but useful for others). One for the queue, one for the topic. Edit them as you see fit.



Maven dependency:

<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>activemq-rar</artifactId>
  <version>5.8.0</version>
  <type>rar</type>
</dependency>

      

The deployed EAR looks like this:

sample.ear
    META-INF
        application.xml
    activemq-rar.rar  (file)
    activemq-config.rar  (directory)
        ra.xml   (extracted from activemq-rar.rar or generated)
        ironjacamar.xml  (generated, then edited)

      

Actually, ra.xml can be extracted from the "real" rar, but it is also generated in the IronJacamar rar-info.sh output file , so take it from.

application.ear looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
  <display-name>JBoss7Sample Ear</display-name>
  <!--   Sample for WebSphereMQ
  <module><connector>wmq.jmsra.rar</connector></module>
  <module><connector>wmq-config.rar</connector></module>
  -->
  <module><connector>activemq-rar.rar</connector></module>
  <module><connector>amq-config.rar</connector></module>  
</application>

      

To emphasize again, this (actually quite simple) job is very important to me because any deployment procedure starts with "Edit the server file called ..... or" In the management console ... "is not a starter in environment I'm targeting in. I need to prevent access to vanilla JBoss 7 (EAP 6.1) internal directories as well as console access as it could be deployed at the end of a Jenkins build or the like .. (Not to mention which edit files to add the deployment are not a starter in themselves).

This workaround and others can be viewed in more detail in this github project , which has been set up specifically to share some working configurations that I found otherwise quite difficult to come by.

PS Since this is the only suggested answer, I am giving the correct answer to myself, but I will give it as the best answer.

+4


source







All Articles