Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

jms - WildFly integration with ActiveMQ using JCA resource adapter

I am trying to integrate ActiveMQ 5.15.13 with WildFly 21.0.1.Final using the ActiveMQ JCA resource adapter. However, I am getting errors while doing it. I was able to integrate WildFly 9 with ActiveMQ 5.10. I'm getting the following errors:

2021-01-22 19:20:18,577 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 93) MSC000001: Failed to start service jboss.ra.deployer."activemq-rar-5.15.13.rar": org.jboss.msc.service.StartException in service jboss.ra.deployer."activemq-rar-5.15.13.rar": WFLYJCA0046: Failed to start RA deployment [activemq-rar-5.15.13.rar]
    at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService$1.run(ResourceAdapterDeploymentService.java:176)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1348)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:513)
Caused by: org.jboss.jca.deployers.common.DeployException: IJ020056: Deployment failed: file:/opt/apps/MerckContivoPilot/wildfly-21.0.1.Final/standalone/deployments/activemq-rar-5.15.13.rar/
    at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:2058)
    at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService$WildFLyRaDeployer.doDeploy(ResourceAdapterDeploymentService.java:233)
    at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService.start(ResourceAdapterDeploymentService.java:126)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.jca.validator.ValidatorException: Severity: WARNING
Section: 20.7
Description: Invalid config-property-type for AdminObject.
Code: Class: org.apache.activemq.pool.XaPooledConnectionFactory Property: tmFromJndi Type: boolean

Severity: ERROR
Section: 13.4.2.2
Description: An ActivationSpec class must implement the ActivationSpec interface
Code: org.apache.activemq.ra.ActiveMQActivationSpec

Severity: ERROR
Section: 5.3.1
Description: A ResourceAdapter must implement the javax.resource.spi.ResourceAdapter interface.
Code: org.apache.activemq.ra.ActiveMQResourceAdapter

Severity: ERROR
Section: 6.5.3.2
Description: The class must implement the javax.resource.spi.ManagedConnectionFactory interface.
Code: org.apache.activemq.ra.ActiveMQManagedConnectionFactory

Resource Adapter configuration

<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0">
    <resource-adapters>
        <resource-adapter id="activemq-ra">
            <archive>activemq-rar-5.15.13.rar</archive>
            <transaction-support>XATransaction</transaction-support>
            <config-property name="ServerUrl">tcp://localhost:61616?soTimeout=20000&amp;connectionTimeout=10000</config-property>
            <config-property name="UserName">defaultUser</config-property>
            <config-property name="UseInboundSession">false</config-property>
            <config-property name="Password">defaultPassword</config-property>
            <connection-definitions>
                <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ActiveMQ/QueueConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQ/QueueConnectionFactory" use-ccm="true">
                    <xa-pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>200</max-pool-size>
                    </xa-pool>
                    <timeout>
                        <blocking-timeout-millis>30000</blocking-timeout-millis>
                        <idle-timeout-minutes>5</idle-timeout-minutes>
                    </timeout>
                </connection-definition>
            </connection-definitions>
            <admin-objects>
                <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/XMLPublishQueue" enabled="true" use-java-context="true" pool-name="XMLPublishQueue">
                    <config-property name="PhysicalName">XMLPublishQueue</config-property>
                </admin-object>
                <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/SupportTasksQueue" enabled="true" use-java-context="true" pool-name="SupportTasksQueue">
                    <config-property name="PhysicalName">SupportTasksQueue</config-property>
                </admin-object>
            </admin-objects>
        </resource-adapter>
    </resource-adapters>
</subsystem>

Downloaded rar from https://mvnrepository.com/artifact/org.apache.activemq/activemq-rar/5.15.13

Tried both ways (updating rar and without updating it) by following the below guides

https://access.redhat.com/solutions/1124023

http://www.mastertheboss.com/jboss-server/jboss-jms/integrate-activemq-with-wildfly

Update: Issue started when I added third-party jars through global-modules section under ee subsystem. I was adding java ee api jar

Any help/suggestions would be appreciated.

question from:https://stackoverflow.com/questions/65854537/wildfly-integration-with-activemq-using-jca-resource-adapter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I deployed the ActiveMQ 5.13.13 JCA resource adapter to Wildfly 21.0.1.Final and I didn't see the same logging you saw. Everything appears to be working just fine. Here's what I did:

  1. Download & unzip WildFly 21.0.1.Final.
  2. Download the ActiveMQ 5.15.13 JCA RA and copy it to standalone/deployments.
  3. Added this to standalone/configuration/standalone-full.xml:
    <subsystem xmlns="urn:jboss:domain:resource-adapters:6.0">
        <resource-adapters>
            <resource-adapter id="activemq-ra-5">
                <archive>activemq-rar-5.15.13.rar</archive>
                <transaction-support>XATransaction</transaction-support>
                <config-property name="ServerUrl">tcp://localhost:61616?soTimeout=20000&amp;connectionTimeout=10000</config-property>
                <config-property name="UserName">defaultUser</config-property>
                <config-property name="UseInboundSession">false</config-property>
                <config-property name="Password">defaultPassword</config-property>
                <connection-definitions>
                    <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ActiveMQ/QueueConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQ/QueueConnectionFactory" use-ccm="true">
                        <xa-pool>
                            <min-pool-size>1</min-pool-size>
                            <max-pool-size>200</max-pool-size>
                        </xa-pool>
                        <timeout>
                            <blocking-timeout-millis>30000</blocking-timeout-millis>
                            <idle-timeout-minutes>5</idle-timeout-minutes>
                        </timeout>
                    </connection-definition>
                </connection-definitions>
                <admin-objects>
                    <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/XMLPublishQueue" enabled="true" use-java-context="true" pool-name="XMLPublishQueue">
                        <config-property name="PhysicalName">XMLPublishQueue</config-property>
                    </admin-object>
                    <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/SupportTasksQueue" enabled="true" use-java-context="true" pool-name="SupportTasksQueue">
                        <config-property name="PhysicalName">SupportTasksQueue</config-property>
                    </admin-object>
                </admin-objects>
            </resource-adapter>
        </resource-adapters>
    </subsystem>
    
  4. Updated the jms-connection-factory attribute in the default-bindings element of the ee subsystem to use java:/ActiveMQ/QueueConnectionFactory:
    <default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection-factory="java:/ActiveMQ/QueueConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
    
  5. Updated the resource-adapter-name attribute of the mdb/resource-adapter-ref element of the ejb3 subsystem to be ${ejb.resource-adapter-name:activemq-rar-5}:
    <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-rar-5}"/>
    
  6. Started WildFly using ./standalone.sh -c standalone-full.xml

Given that all this works normally I would say your problem is your global module, especially since it includes Java EE API classes. Application jars and library jars should not include Java/Jakarta EE API classes. The EE server (e.g. WildFly) provides all those. If you (or someone else) provides their own then that will cause classloading problems and that, in turn, will cause a lot of other weird problems. To reiterate, there's absolutely no reason for you to package Java/Jakarta EE API classes with your application or libraries deployed on the server.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...