1

我需要将 WebSphere MQ7 队列(在队列管理器 QMA 中说 queA)映射到 EJB3 MDB。

我使用创建 MQ 队列管理器和队列
crtmqm QMA并使用它启动它strmqm MQA
然后我写了一个文件文件名QMA.conf并包含
DEFINE QLOCAL ('queA')
它并运行命令
runmqsc QMA < QMA.conf
然后我运行
strmqcsv MQA &
runmqlsr -m QMA -t TCP &
所有这些步骤作为 mqm 登录用户完成。

然后我按照 http://community.jboss.org/wiki/JBossEAP5IntegrationwithWebSphereMQ 链接配置 RAR 到 jboss 5.1。当我运行也成功的测试连接时。

在那里我包括

* channel - SYSTEM.DEF.SVRCONN
* hostName - localhost
* port - 1414
* queueManager - ExampleQM
* transportType - CLIENT

在我的 MDB 中,我包括

@MessageDriven( name="WMQMDBTest",
        activationConfig = 
        { 
            @ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"),
            @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),
            @ActivationConfigProperty(propertyName = "destination", propertyValue = "queA"),
            @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
            @ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),
            @ActivationConfigProperty(propertyName = "hostName", propertyValue = "localhost"),
            @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QMA"),
            @ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),
            @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT"),
            @ActivationConfigProperty(propertyName = "username", propertyValue = "mqm"),
            @ActivationConfigProperty(propertyName = "password", propertyValue = "password")
        }) 
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter(value = "wmq.jmsra.rar")

当我尝试部署 bean 时,它说

DEPLOYMENTS IN ERROR:
  Deployment "jboss.j2ee:ear=integration-1.0-SNAPSHOT.ear,jar=business-logic-1.0-SNAPSHOT.jar,  
  name=WMQMDBTest,service=EJB3" is in error due to the following reason(s): 
javax.naming.NameNotFoundException: queA not bound
4

1 回答 1

2

你写过

        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queA"),
        @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),

使用useJNDI属性暗示“queA”是 JMS 队列绑定到 JNDI 命名空间的名称 - 这与您在此处定义的队列不直接对应

定义本地('queA')

如果希望它引用队列管理器上的物理 WMQ 队列,则需要将 useJNDI 属性设置为 false,在这种情况下,destination 指定队列管理器上的队列名称,而不是 JNDI 名称。另一方面,如果您确实想使用目的地的 JNDI 查找,那么您需要确保指定的目的地名称与 -ds.xml 文件中的队列定义相匹配,例如

        @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/request")

将对应

<mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=request_queue">
    <attribute name="JNDIName">jms/request</attribute>
    <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
    <attribute name="Type">javax.jms.Queue</attribute>
    <attribute name="Properties">
        baseQueueManagerName=QMA            
        baseQueueName=queA
    </attribute>
</mbean>

注意 mbean 的 JNDIName 属性对应目标名称

于 2011-08-15T15:17:41.270 回答