[英]WildFly 10 with WebSphere MQ 9 : onMessage MDB deploy error
- I have an MDB for consuming a message of a Queue, on Jboss EAP 7.0.6 GA, IBM MQ 9
我有一个 MDB,用于在 Jboss EAP 7.0.6 GA、IBM MQ 9 上使用队列消息
package com.ryzorbent.demo.jms; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.ejb.TransactionAttribute; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.TextMessage; import org.jboss.ejb3.annotation.ResourceAdapter; @MessageDriven(name="EFRSTestMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"), @ActivationConfigProperty(propertyName = "hostName", propertyValue = "localhost"), @ActivationConfigProperty(propertyName = "port", propertyValue = "1414"), @ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"), @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "EFRS_UAT"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/QUEUE"), @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT") }) @ResourceAdapter(value = "wmq.jmsra.rar") //@TransactionAttribute(value = "NoTransaction") public class EFRSTestMDB implements MessageListener { @Override public void onMessage(Message inMessage) { TextMessage message = (TextMessage)inMessage; try { System.out.println(String.format("Hello, %s", message.getText())); } catch (JMSException e) { e.printStackTrace(); } } }
- I copied the wmq.jmsra.rar into the ../standalone/deployments
我把wmq.jmsra.rar复制到 ../standalone/deployments
- Added the resource-adapters subsystem for the queues, channels, etc into the standalone-full.xml
将队列、通道等的资源适配器子系统添加到 standalone-full.xml
- But i get the below error
但我收到以下错误
java.lang.NoClassDefFoundError: Failed to link com/ryzorbent/demo/jms/EFRSTestMDB (Module "deployment.TestJbossMDB.jar:main" from Service Module Loader): javax/jms/MessageListener
The wmq.jmsra.rar
does not contain the JMS API classes like javax/jms/MessageListener
from your error. wmq.jmsra.rar
不包含来自您的错误的 JMS API 类,如javax/jms/MessageListener
。 In Limitations and Known Problems it says:在限制和已知问题中,它说:
The deployment of the IBM WebSphere® MQ 7.5 resource adapter does not load the javax.jms.api module for your deployment.
IBM WebSphere® MQ 7.5 资源适配器的部署不会为您的部署加载 javax.jms.api 模块。 It also does not provide support for the new Jave EE 7 annotations like @JMSConnectionFactoryDefinitions, @JMSDestinationDefinition.
它还不支持新的 Jave EE 7 注释,如 @JMSConnectionFactoryDefinitions、@JMSDestinationDefinition。 It is necessary to have the messaging-activemq subsystem in the configuration to enable it.
必须在配置中包含 messages-activemq 子系统才能启用它。 If you do not want the JBoss EAP messaging server to be started, add an empty messaging-activemq subsystem.
如果您不想启动 JBoss EAP 消息服务器,请添加一个空的 messages-activemq 子系统。
So you have to add the JMS api jars as well like described above.所以你必须像上面描述的那样添加 JMS api jar。
hWhen using IBM MQ messaging, always start with a "full" server configuration file such as standalone-full.xml. h使用 IBM MQ 消息传递时,始终从“完整”服务器配置文件开始,例如 standalone-full.xml。 The "full" configuration files include JMS messaging.
“完整”配置文件包括 JMS 消息传递。
As a side note, I see that your activation spec has:作为旁注,我看到您的激活规范具有:
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/QUEUE"),
So you have useJNDI to false, but then you have destination that sure looks like a JNDI name.因此,您将 useJNDI 设置为 false,但是您的目标确实看起来像 JNDI 名称。 When you have useJNDI set to false, the destination name is the name of the queue on the IBM MQ side - normally in all caps, much like your queue manager and channel.
当您将 useJNDI 设置为 false 时,目标名称是 IBM MQ 端的队列名称 - 通常全部大写,很像您的队列管理器和通道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.