收到这样的警告,我无法停止自动确认。
768 WARN [org.jboss.as.ejb3] JBAS014105: ActivationConfigProperty acknowledgeMode will be ignored since it is not allowed by resource adapter: genericra
2016-08-10 15:51:38,769 INFO [org.jboss.as.ejb3] JBAS014142: Started message driven bean 'UldLaneMDB' with 'genericra' resource adapter
2016-08-10 15:51:38,770 WARN [org.jboss.as.ejb3] JBAS014105: ActivationConfigProperty acknowledgeMode will be ignored since it is not allowed by resource adapter: genericra
2016-08-10 15:51:38,771 INFO [org.jboss.as.ejb3] JBAS014142: Started message driven bean 'ServiceRecoveryMDB' with 'genericra' resource adapter
2016-08-10 15:51:38,772 WARN [org.jboss.as.ejb3] JBAS014105: ActivationConfigProperty acknowledgeMode will be ignored since it is not allowed by resource adapter: genericra
2016-08-10 15:51:38,772 WARN [org.jboss.as.ejb3] JBAS014105: ActivationConfigProperty acknowledgeMode will be ignored since it is not allowed by resource adapter: genericra
2016-08-10 15:51:38,774 WARN [org.jboss.as.ejb3] JBAS014105: ActivationConfigProperty acknowledgeMode will be ignored since it is not allowed by resource adapter: genericra
2016-08-10 15:51:38,774 INFO [org.jboss.as.ejb3] JBAS014142: Started message driven bean 'PublishAwbMDB' with 'genericra' resource adapter
2016-08-10 15:51:38,774 INFO [org.jboss.as.ejb3] JBAS014142: Started message driven bean 'PublishBookingMDB' with 'genericra' resource adapter
2016-08-10 15:51:38,775 INFO [org.jboss.as.ejb3] JBAS014142: Started message driven bean 'NextWABMDB' with 'genericra' resource adapter
注意:我没有genericra.rar的源代码,但是它部署在所有环境中,我不确定那里有什么。 我也是Java Programming的新手。
这是ejb-jar.xml
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
metadata-complete="true">
<enterprise-beans>
<message-driven>
<ejb-name>PublishAwbMDB</ejb-name>
<ejb-class>com.lsyas.receivebookingservice.mdb.PublishAwbMDB
</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType
</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationJndiName
</activation-config-property-name>
<activation-config-property-value>${jms.queue.publishAwb}
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectionFactoryJndiName
</activation-config-property-name>
<activation-config-property-value>EAIQueueConnectionFactory
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>CLIENT_ACKNOWLEDGE</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>PublishBookingMDB</ejb-name>
<ejb-class>com.lsyas.receivebookingservice.mdb.PublishBookingMDB
</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType
</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationJndiName
</activation-config-property-name>
<activation-config-property-value>${jms.queue.publishBookingDetails}
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectionFactoryJndiName
</activation-config-property-name>
<activation-config-property-value>EAIQueueConnectionFactory
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>CLIENT_ACKNOWLEDGE</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>ServiceRecoveryMDB</ejb-name>
<ejb-class>com.lsyas.receivebookingservice.mdb.ServiceRecoveryMDB
</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType
</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationJndiName
</activation-config-property-name>
<activation-config-property-value>${jms.queue.publishServiceRecoveryCase}
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectionFactoryJndiName
</activation-config-property-name>
<activation-config-property-value>EAIQueueConnectionFactory
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>CLIENT_ACKNOWLEDGE</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>UldLaneMDB</ejb-name>
<ejb-class>com.lsyas.receivebookingservice.mdb.UldLaneMDB</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType
</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationJndiName
</activation-config-property-name>
<activation-config-property-value>${jms.queue.publishUldLaneDetails}
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectionFactoryJndiName
</activation-config-property-name>
<activation-config-property-value>EAIQueueConnectionFactory
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>CLIENT_ACKNOWLEDGE</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>NextWABMDB</ejb-name>
<ejb-class>com.lsyas.receivebookingservice.mdb.NextWABMDB</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType
</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationJndiName
</activation-config-property-name>
<activation-config-property-value>${jms.queue.publishNextWAB}
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectionFactoryJndiName
</activation-config-property-name>
<activation-config-property-value>EAIQueueConnectionFactory
</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>CLIENT_ACKNOWLEDGE</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
<session>
<ejb-name>AutomaticSchedulerBean</ejb-name>
<ejb-class>com.lsyas.receivebookingservice.service.AutomaticSchedulerBean</ejb-class>
<session-type>Stateless</session-type>
<timer>
<schedule>
<second>01</second>
<minute>*</minute>
<hour>*</hour>
<month>*</month>
<year>*</year>
</schedule>
<timeout-method>
<method-name>backgroundProcessing</method-name>
<method-params>
<method-param>javax.ejb.Timer</method-param>
</method-params>
</timeout-method>
<persistent>false</persistent>
</timer>
</session>
</enterprise-beans>
</ejb-jar>
我的一个MDB看起来像这样
package com.lsyas.receivebookingservice.mdb;
import javax.ejb.MessageDriven;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import javax.jms.TextMessage;
import org.jboss.ejb3.annotation.ResourceAdapter;
import org.jboss.logging.Logger;
import com.lsyas.receivebookingservice.StatisticExceptionDetector;
import com.lsyas.receivebookingservice.service.MessageProcessor;
@MessageDriven(mappedName = "UldLaneMDB")
@TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter("genericra.rar")
public class UldLaneMDB implements MessageListener {
private static final Logger LOG = Logger.getLogger(UldLaneMDB.class);
private final MessageProcessor messageProcessor;
public UldLaneMDB() {
this.messageProcessor = new MessageProcessor();
StatisticExceptionDetector statisticExceptionDetector = new StatisticExceptionDetector();
Thread.setDefaultUncaughtExceptionHandler(statisticExceptionDetector);
}
@Override
public void onMessage(Message message) {
try {
if (message instanceof TextMessage) {
TextMessage msg = (TextMessage) message;
this.messageProcessor.processUldLaneXMLMessage(msg.getText());
} else if (message instanceof ObjectMessage) {
LOG.error("Received message was an ObjectMessage and will be ignored!");
} else {
LOG.error("Received message was not an Object- or TextMessage and will be ignored!");
}
} catch (JMSException e) {
LOG.error("Exception during onMessage.", e);
}
}
}
提前谢谢
答案 0 :(得分:0)
您对CLIENT_ACKNOWLEDGE的使用不正确:
hashes
请参阅:
http://docs.oracle.com/javaee/6/tutorial/doc/bncfu.html#bncfw
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>CLIENT_ACKNOWLEDGE</activation-config-property-value>
</activation-config-property>
对于消息驱动Bean,JEE容器负责确认消息。一旦onMessage()方法完成,JBoss就会确认该消息。