How can I deploy a resource-adapter activation in JBoss 7?

后端 未结 1 1653
感情败类
感情败类 2020-12-21 15:27

I am trying to figure out how to deploy a resource-adapter activation in JBoss 7. Basically, I want to be able to package and deploy a full application without having to mod

相关标签:
1条回答
  • 2020-12-21 15:40

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

    For each given vendor RAR, 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 the section titled 10.1. Resource adapter information tool int the user guide.

    Using ActiveMQ 5.8.0 as an example:

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

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

    The extracted part of the file that will become ironjacamar.xml starts after that header and ends with </resource-adapters>.

    The following edits should be applied:

    1. Remove the opening <resource-adapters> and <resource-adapter> tags and replace with an <ironjacamar.xml> opening tag.
    2. Remove the opening <archive> tag.
    3. Remove the closing </resource-adapter> and </resource-adapters> tags and replace with an </ironjacamar.xml> closing tag.

    There are sample definitions for connection factories for each type of connection (Connection, Queue and Topic) which include a JNDI name where JBoss will bind the factories to. Edit these as you see fit. I only needed the Connection factory so I edited the JNDI name and deleted the other two definitions.

    There are sample definitions for destination references (which are almost un-necessary with ActiveMQ, but it's helpful for others). One for a queue, one for a topic. Edit these as you see fit.

    The maven dependency:

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

    The deployable 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, the 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 either.

    The application.ear then 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 re-emphasize, this (actually quite simple) work around is important to me because any deployment procedure that starts with "Edit the server file called..... or "In the management console....." is a non-starter in the environment I am targeting. I need to assume no access to a vanilla JBoss 7 (EAP 6.1) internal directories, nor access to the console, as one might deploy at the end of a Jenkins build or the like.. (Not to mention which, editing files to add a deployment is a non-starter all by itself).

    This workaround and others can be viewed in more detail in this github project which was setup specifically to share some working configurations which I have found are otherwise fairly difficult to come by.

    P.S. Since this is the only offered answer, I am awarding the correct answer to myself, but I'll give it up for a better answer.

    0 讨论(0)
提交回复
热议问题