Wildfly Swarm - 资源适配器(IBM wmq.jmsra.rar)

时间:2018-02-08 09:41:20

标签: adapter messaging wildfly-swarm

在这些时刻,我尝试在Java项目中使用Wildfly Swarm配置IBM wmq.jmsra.rar资源适配器,但没有成功。 这些是我到目前为止所做的步骤:

1)pom.xml(手工安装工件)

<dependency>
    <groupId>com.ibm.mq</groupId>
    <artifactId>mq</artifactId>
    <version>7.5.0.8</version>
    <type>rar</type>
</dependency>

2)此资源适配器的module.xml(在src / main / resources / modules / com / ibm / wsmq / main中):

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:2.0" name="com.ibm.mq">
    <resources>
        <resource-root path="." />
        <resource-root path="com.ibm.mq.commonservices.jar" />
        <resource-root path="com.ibm.mq.connector.jar" />
        <resource-root path="com.ibm.mq.headers.jar" />
        <resource-root path="com.ibm.mq.jar" />
        <resource-root path="com.ibm.mq.jmqi.jar" />
        <resource-root path="com.ibm.mq.jmqi.local.jar" />
        <resource-root path="com.ibm.mq.jmqi.remote.jar" />
        <resource-root path="com.ibm.mq.jmqi.system.jar" />
        <resource-root path="com.ibm.mq.jms.admin.jar" />
        <resource-root path="com.ibm.mq.pcf.jar" />
        <resource-root path="com.ibm.mqjms.jar" />
        <resource-root path="com.ibm.msg.client.commonservices.j2se.jar" />
        <resource-root path="com.ibm.msg.client.commonservices.jar" />
        <resource-root path="com.ibm.msg.client.jms.internal.jar" />
        <resource-root path="com.ibm.msg.client.jms.jar" />
        <resource-root path="com.ibm.msg.client.matchspace.jar" />
        <resource-root path="com.ibm.msg.client.provider.jar" />
        <resource-root path="com.ibm.msg.client.ref.jar" />
        <resource-root path="com.ibm.msg.client.wmq.common.jar" />
        <resource-root path="com.ibm.msg.client.wmq.factories.jar" />
        <resource-root path="com.ibm.msg.client.wmq.jar" />
        <resource-root path="com.ibm.msg.client.wmq.v6.jar" />
        <resource-root path="dhbcore.jar" />
    </resources>
    <dependencies>
        <module name="javax.api" />
        <module name="javax.resource.api" />
        <module name="javax.jms.api" />
        <module name="javax.management.j2ee.api" />
    </dependencies>
</module>

注意:在此路径的主文件夹中,我也复制了mq-7.5.0.8.rar文件。

3)project-stages.yml:

资源适配器:    资源适配器:       MQ:          存档:mq.rar          交易支持:XATransaction
         连接的定义:             BSMConnectionFactoryHigh:                class-name:com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl                jndi-name:jms / bsmConnectionFactoryHigh                配置属性:                   主机名:                      价值:tqhr0712.sede.corp.sanpaoloimi.com                   的QueueManager:                      值:TQHR0712                   港口:                      价值:1412                   渠道:                      值:CH.BSMA.CONN                   transportType:                      价值:客户

         管理的对象:             BSMSendQueueHigh:                class-name:com.ibm.mq.connector.outbound.MQQueueProxy                jndi-name:jms / bsmSendQueueHigh                配置属性:                   baseQueueName:                      值:QLOCAL.DATAGRAM.WUO.UOS4APPO9                   baseQueueManagerName:                     价值:TQHR0712

部署:    com.ibm.mq:mq.rar:

然后,当我运行项目时,我收到此错误:

2018-02-08 10:33:54 INFO <org.jboss.as.server.deployment> <MSC service thread 1-7> WFLYSRV0028: Stopped deployment mq.rar (runtime-name: mq.rar) in 72ms
2018-02-08 10:33:54 INFO <org.jboss.as.controller> <main> WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.resourceadapters-subsystem (missing) dependents: [service jboss.deployment.unit."mq.rar".CONFIGURE_MODULE] 

有人会帮忙解决这个问题吗?

非常感谢。

1 个答案:

答案 0 :(得分:0)

我很高兴地告诉您,我发现如何使Wildfly Swarm和IBM websphere mq资源适配器集成成功。

以下是要遵循的步骤:

1)从IBM(版本8.x)获取wmq.jmsra.rar

2)为此文件创建工件,如下所示:

                   <dependency>
                                   <groupId>com.ibm</groupId>
                                   <artifactId>mq</artifactId>
                                   <version>8.0.0.7</version>
                                   <type>rar</type>
                   </dependency> 
                   <dependency>
                                   <groupId>com.ibm</groupId>
                                   <artifactId>mq</artifactId>
                                   <version>8.0.0.7</version>
                                   <type>jar</type>
                                   <scope>provided</scope>
                   </dependency>

3)src / main / resources:     a)创建文件夹模块。     b)在modules模块文件夹中创建com / ibm / mq / main。    c)在主文件夹内复制资源适配器(.rar文件)和       将其重命名为mq.rar。    d)在main主文件夹中创建文件module.xml,如下所示:

<?xml version="1.0" encoding="UTF-8"?>    
<module xmlns="urn:jboss:module:2.0" name="com.ibm.mq">    
    <resources>    
        <resource-root path="." />    
        <resource-root path="com.ibm.mq.connector.jar" />
        <resource-root path="com.ibm.mq.headers.jar" />
        <resource-root path="com.ibm.mq.jar" />
        <resource-root path="com.ibm.mq.jmqi.jar" />    
        <resource-root path="com.ibm.mq.pcf.jar" />    
        <resource-root path="com.ibm.mq.jmqi.local.jar" />    
        <resource-root path="com.ibm.mqjms.jar" />    
    </resources>    
    <dependencies>    
        <module name="javax.api" />    
        <module name="javax.resource.api" />    
        <module name="javax.jms.api" />    
        <module name="javax.management.j2ee.api" />    
    </dependencies>    
</module>

4)project-stages.yml:

群:     JCA:        存档验证:           启用:false           失败警告:错误

资源适配器:    资源适配器:       MQ:          存档:mq.rar          交易支持:XATransaction
         连接的定义:             ReinoltroConnectionFactory:                class-name:com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl                jndi-name:jms / testConnectionFactory                恢复户名:                恢复密码:                追踪:假                pool-name:MQCONNF                配置属性:                   主机名:                      值:                   的QueueManager:                      值:                   港口:                      值:                   渠道:                      值:                   transportType:                      价值:客户

         管理的对象:             testQueue:                class-name:com.ibm.mq.connector.outbound.MQQueueProxy                jndi-name:jms / testQueue                pool-name:MQQUEUENAME                配置属性:                   baseQueueName:                      值:                   baseQueueManagerName:                     价值:

部署:    com.ibm:mq.rar:

5)Java代码(使用JMS 2发送消息)

@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class RichiesteServiceImpl {
 ....
    @Inject
    @JMSConnectionFactory("java:/jms/reinoltroConnectionFactory")
    JMSContext jmsContext;

    @Resource(mappedName = "java:/jms/reinoltroBDQueue")    
    Queue testQueue;
 .....

     public boolean sendMessage()  {

        boolean esitoReinoltro = false;

        try {
            jmsContext.createProducer().send(reinoltroQueue, "Messaggio di prova" );

            esitoReinoltro = true;

            return esitoReinoltro;
        }
        catch(Exception e) {        
            throw new ServiceException(e);
        }
    }
}

并完成了工作。