在 WebSphere 7 中将队列绑定到 EJB 3.0 MDB
我正在或者试图在 WebSphere 7 上编写 Baby's First MDB。我几乎已经精疲力竭,竭尽全力想让它发挥作用。看来我已将所有内容设置正确,但当我将消息放入关联队列时却没有得到任何响应。
以下是 EAR 文件设置:
simplemdb.ear
META-INF
Manifest.mf
application.xml
simplemdb.jar
META-INF
Manifest.mf
ejb-jar.xml
com
[ classes go here ]
我在 ejb-jar.xml 中找不到任何用于定义队列的 JNDI 名称的语法,因此我:
- 定义一个 WebSphere 激活规范。名称 SimpleMDBActivationSpec,JNDI 名称 jms/SimpleActivationSpec,目标 jms/SimpleMDBQueue。
- 定义 WebSphere 队列。名称 SimpleMDBQueue,JNDI 名称 jms/SimpleMDBQueue,队列名称 SIMPLE.MDB.QUEUE。
- 定义一个 MQ 队列,名称为 SIMPLE.MDB.QUEUE。
- 部署 EAR 文件。在部署过程中,系统会要求我输入绑定信息。我选择“激活规范”,然后分别将“目标资源 JNDI 名称”和“目标 JNDI 名称”指向激活规范和队列。
(MDB代码没有注释。)此时,app指向spec和queue,spec指向queue——腰带和吊带。当然,我想应用程序因此知道队列。满怀希望,我在队列中放了一条消息,然后……什么也没有。 onMessage 事件应该使用 System.out 来记录消息。我没有看到任何消息。
关于这一点的明确文档因其缺失而引人注目。谷歌提供了很多结果,但没有一个详细说明配置如何组合在一起。有很多关于 ibm-ejb-jar-bnd.xmi 的问题,但该文件的示例很晦涩难懂,充满了不透明的数字,没有解释它们是如何生成的,或者它们与配置的其他部分如何相关。
看在上帝的份上。我想做的就是部署一个 MDB,并在我将消息放入队列时让它写入“Hello, world”。我使用 vi 和 ant 作为我的开发和构建工具。有人可以告诉我我缺少什么吗?
编辑:添加“zos”标签。
I'm writing, or trying to write, Baby's First MDB on WebSphere 7. I have nearly no hair left, having pulled it all out trying to get the thing to work. It appears that I've got everything set up right, but I get no response when I put a message to the associated queue.
Here's the EAR file setup:
simplemdb.ear
META-INF
Manifest.mf
application.xml
simplemdb.jar
META-INF
Manifest.mf
ejb-jar.xml
com
[ classes go here ]
I can't find any syntax for defining the queue's JNDI name in ejb-jar.xml, so instead I:
- Define a WebSphere activation spec. Name SimpleMDBActivationSpec, JNDI name jms/SimpleActivationSpec, Destination jms/SimpleMDBQueue.
- Define a WebSphere queue. Name SimpleMDBQueue, JNDI name jms/SimpleMDBQueue, Queue name SIMPLE.MDB.QUEUE.
- Define an MQ queue, name SIMPLE.MDB.QUEUE.
- Deploy the EAR file. During the deployment, I'm asked to enter binding information. I select Activation Specification, then point the Target Resource JNDI Name and Destination JNDI name at the activation spec and queue, respectively.
(The MDB code has no annotations.) At this point, the app points to the spec and queue, and the spec points to the queue - belt and suspenders. Naturally, I imagine that the app therefore knows about the queue. Full of hope, I put a message on the queue, and ... nothing. The onMessage event is supposed to use System.out to log a message. I see no message.
Clear documentation on this is conspicuous by its absence. Google gives LOTS of results, but none of them details how the configuration all fits together. There's lots of hand-waving about ibm-ejb-jar-bnd.xmi, but examples of the file are arcane, full of opaque numbers with no explanation about how they were generated, or how they relate to other parts of the configuration.
For goodness' sake. All I want to do is deploy an MDB, and have it write "Hello, world" when I put a message to a queue. I'm using vi and ant as my development and build tools. Can anybody out there give me an idea about what I'm missing?
Edit: "zos" tag added.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现了问题。它特定于在 z/OS 上运行的 WebSphere。为了使激活规范在该环境中完全可用,必须启动控制区域附件 (CRA) 进程。我告诉 WAS 启动它,回收应用程序服务器,瞧!我的 MDB 开始响应。
要通过 WebSphere 管理控制台启动 CRA,请转至...
...并选中“启动 CRA”框。单击“确定”,将其保存到主配置,并让 CRA 实际启动,关闭并备份应用程序服务器。 (这是针对 WAS 7.0 的。)
感谢大家的时间和思考空间。
I found the problem. It's specific to WebSphere running on z/OS. For an activation spec to be fully available in that environment, the Control Region Adjunct (CRA) process must be started. I told WAS to start it up, recycled the app server, and lo! My MDB started responding.
To make the CRA start via the WebSphere Admin Console, go to ...
... and check the box that says "Start CRA". Hit OK, save it to the master configuration, and to make the CRA actually start, bring the app server down and back up. (This is for WAS 7.0.)
Thanks to everyone for their time and thoughtspace.
快速浏览一下,看看这里是否有任何对您有帮助的内容。
http ://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wasfpejb/wasfpejb/6.1/DevelopmentTools/WASv61_EJB3FP_MDBLab.pdf
我最后没有玩过这个一年了,所以我无法立即发表评论,但我认为 PDF 可能对您有一些帮助。
HTH
曼格鲁
have a quick look at this and see if there is anything here that helps you.
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wasfpejb/wasfpejb/6.1/DevelopmentTools/WASv61_EJB3FP_MDBLab.pdf
I haven't played with this for the last one year so i am not able to comment straight away but i thought the PDF might be of some assistance to you.
HTH
Manglu