jms 队列问题 环境,myeclipse9.0+jboss6
部署jms项目时,、创建队列失败,一直在等待队列的创建,
12:21:21,352 INFO [org.hornetq.ra.inflow.HornetQActivation] Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@df16cd destination=Queue/myqueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
12:21:21,364 INFO [org.hornetq.ra.inflow.HornetQActivation] awaiting topic/queue creation Queue/myqueue
下面是EJB项目的源码:
package com.my.test.jms;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.ejb.ActivationConfigProperty;
@MessageDriven (
activationConfig ={
@ActivationConfigProperty(propertyName="destinationType",propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination",propertyValue = "Queue/myqueue")
}
)
public class MyQueueMDB implements MessageListener {
public void onMessage(Message msg) {
TextMessage txtMsg = (TextMessage)msg;
try {
System.out.println("服务器端收到消息啦"+txtMsg.getText());
} catch (JMSException e) {
e.printStackTrace();
}
}
}
------解决方案--------------------
该文件适用于4.x版JBoss的。对于5.x和更高的队列/主题不自动创建的,除非你明确地配置jboss.xml的消息驱动部分(目前只通过jboss.xml)