如何将 websphere mq 7 队列映射到 EJB 3 目的地名称

发布于 2024-11-14 18:19:23 字数 2430 浏览 5 评论 0原文

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

我使用
创建了 MQ 队列管理器和队列 crtmqm QMA 并使用 strmqm MQA 启动它
然后我写了一个文件文件名 QMA.conf 并包含
定义 QLOCAL ('queA')
将其排列并运行命令
runmqsc QMA runmqsc QMA 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

I need to map WebSphere MQ7 queue (Say queA in Queue Manager QMA) to a EJB3 MDB.

I created the MQ Queue Manager and Queue using
crtmqm QMA and start it using strmqm MQA
Then i wrote a file file name QMA.conf and included
DEFINE QLOCAL ('queA')
line it and run the command
runmqsc QMA < QMA.conf
then I run
strmqcsv MQA &
runmqlsr -m QMA -t TCP &
All these steps done as mqm logged user.

Then I follow
http://community.jboss.org/wiki/JBossEAP5IntegrationwithWebSphereMQ
link and configure RAR to the jboss 5.1. When I run the test connection that also succeeded.

There I include

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

and In my MDB I include

@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")

When I try to deploy the bean it says

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北凤男飞 2024-11-21 18:19:23

你写过

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

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

定义 QLOCAL ('queA')

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

 @ActivationConfigProperty(propertyName = "目的地", 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 属性对应于目标名称

You've written

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

with the useJNDI property implying that 'queA' is the name under which the JMS Queue is bound into the JNDI namespace - this does not directly correspond to the queue you have defined here

DEFINE QLOCAL ('queA')

If you want it to refer to a physical WMQ queue on your queue manager then you need the useJNDI property set to false, in which case destination specifies the name of a queue on the queue manager, not a JNDI name. On the other hand, if you do want to use JNDI lookup of Destinations then you need to ensure that the destination name specified matches the Queue definition in the -ds.xml file, e.g.

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

would correspond to

<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>

note the JNDIName attribute of the mbean corresponds to the destination name

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文