CloudBees 在其 clickstart 中添加了一个新的 Java EE 7/Glassfish 4 Full 平台。如果我理解正确,这意味着它支持所有 Java EE 7 功能(包含 JMS 应用程序)。但是当我运行我的 JMS 应用程序时,它会记录一个错误“无法从连接池获取/创建连接 [jms/__defaultConnectionFactory-Connection-Pool”
这是我的代码,它在我的本地主机中工作:
@Named
@RequestScoped
public class ReceiverBean {
static final Logger logger = Logger.getLogger("ReceiverBean");
@Inject
private JMSContext context;
@Resource(lookup = "java:comp/jms/webappQueue")
private Queue queue;
.....
public void getMessage() {
try {
JMSConsumer receiver = context.createConsumer(queue);
String text = receiver.receiveBody(String.class, 1000);
if (text != null) {
FacesMessage facesMessage =
new FacesMessage("Reading message: " + text);
FacesContext.getCurrentInstance().addMessage(null, facesMessage);
} else {
FacesMessage facesMessage =
new FacesMessage("No message received after 1 second");
FacesContext.getCurrentInstance().addMessage(null, facesMessage);
}
} catch (JMSRuntimeException t) {
logger.log(Level.SEVERE,
"ReceiverBean.getMessage: Exception: {0}",
t.toString());
}
}
CloudBees 控制台 glassfish 的日志:
[#|2013-11-19T07:36:43.737+0000|INFO|glassfish 4.0|javax.enterprise.resource.jms.com.sun.enterprise.connectors.jms.system|_ThreadID=21;_ThreadName=http-listener- 1(1);_TimeMillis=1384846603737;_LevelValue=800;_MessageID=addresslist.setjmsservice.provider;| JMS010:setJmsServiceProvider 中的地址列表:mq://localhost:0/|#]
[#|2013-11-19T07:36:43.738+0000|INFO|glassfish 4.0|javax.enterprise.resource.jms.com.sun.enterprise.connectors.jms.system|_ThreadID=21;_ThreadName=http-listener- 1(1);_TimeMillis=1384846603738;_LevelValue=800;_MessageID=jms.connection.url;| JMS08:JMS 服务连接 URL 为:mq://localhost:0/|#]
[#|2013-11-19T07:36:44.552+0000|INFO|glassfish 4.0|javax.resourceadapter.mqjmsra.lifecycle|_ThreadID=21;_ThreadName=http-listener-1(1);_TimeMillis=1384846604552;_LevelValue=800 ;| MQJMSRA_RA1101:GlassFish MQ JMS 资源适配器:版本:5.0(Build 14-e)编译:2013 年 4 月 12 日 0104|#]
[#|2013-11-19T07:36:44.559+0000|INFO|glassfish 4.0|javax.resourceadapter.mqjmsra.lifecycle|_ThreadID=21;_ThreadName=http-listener-1(1);_TimeMillis=1384846604559;_LevelValue=800 ;| MQJMSRA_RA1101:GlassFish MQ JMS 资源适配器正在启动:代理是 EMBEDDED,连接模式是 Direct|#]
[#|2013-11-19T07:36:44.847+0000|INFO|glassfish 4.0|imq.log.Logger|_ThreadID=21;_ThreadName=http-listener-1(1);_TimeMillis=1384846604847;_LevelValue=800;| [B1002]: 找不到 imqbroker 的现有属性文件,不会加载存储的属性 |#]
[#|2013-11-19T07:36:45.558+0000|SEVERE|glassfish 4.0||_ThreadID=21;_ThreadName=Thread-4;_TimeMillis=1384846605558;_LevelValue=1000;| 经纪人退出。|#]
[#|2013-11-19T07:36:45.562+0000|INFO|glassfish 4.0|javax.resourceadapter.mqjmsra.lifecycle|_ThreadID=21;_ThreadName=http-listener-1(1);_TimeMillis=1384846605562;_LevelValue=800 ;| MQJMSRA_RA1101:GlassFish MQ JMS 资源适配器已启动:嵌入|#]
[#|2013-11-19T07:36:49.808+0000|警告|glassfish 4.0|javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors|_ThreadID=22;_ThreadName=http-listener-1(2) ;_TimeMillis=1384846609808;_LevelValue=900;_MessageID=poolmgr.get_connection_failure;| RAR5117:无法从连接池 [jms/__defaultConnectionFactory-Connection-Pool] 获取/创建连接。原因:com.sun.appserv.connectors.internal.api.PoolingException|#]
[#|2013-11-19T07:36:49.811+0000|SEVERE|glassfish 4.0|SenderBean|_ThreadID=22;_ThreadName=http-listener-1(2);_TimeMillis=1384846609811;_LevelValue=1000;| SenderBean.sendMessage:异常:com.sun.messaging.jms.MQRuntimeException:MQRA:DCF:分配失败:createConnection:分配连接时出错。原因:空|#]
谁能告诉我为什么?提前谢谢了