我正在使用wildfly jms队列...我正在使用wildfly 9.0.2.Final
我让制作人像这样:
@Inject
private JMSContext jmsContext;
private JMSProducer jmsProducer;
@Resource(mappedName = "java:/jboss/exported/jms/queue/TosDownloadReport")
private Queue queueDownloadReport;
public void downloadReport(String adminId, DownloadReportFilter filter){
try {
jmsProducer = jmsContext.createProducer();
String requestParam = Json.getInstance().getObjectMapper().writeValueAsString(filter);
LOG.info("requestParam {}", requestParam);
String id = UUID.randomUUID().toString().replace("-", "");
RoutingRequest request = new RoutingRequest();
request.putProperty("id", id);
request.putProperty("adminId", adminId);
request.putProperty("parameterRequest", requestParam);
QueueMsgDownloadReport message = new QueueMsgDownloadReport();
message.setId(id);
message.setAdminId(adminId);
String jsonMsg = Json.getInstance().getObjectMapper().writeValueAsString(message);
gatewayService.send(RESOURCE, METHOD, request);
jmsProducer.send(queueDownloadReport, jsonMsg);
} catch (Exception e) {
LOG.error(e.getMessage(),e);
}
}
但有时我得到这样的异常,我必须重新启动wildfly
2017-05-05 11:08:20,004 ERROR [com.daksa.tos.infrastructure.api.TosTimer] (EJB default - 7) Could not create a session: IJ000453: Unable to get managed connection for java:/JmsXA: javax.jms.JMSRuntimeException: Could not create a session: IJ000453: Unable to get managed connection for java:/JmsXA
Caused by: javax.resource.ResourceException: IJ000655: No managed connections available within configured blocking timeout (30000 [ms])
从我读的内容来看,如果我正在使用注入权,我不需要调用jmsContext.close()吗?
请告诉我我做错了什么......谢谢
答案 0 :(得分:0)
这个问题解决了吗?我在JBoss EAP 7.1上也遇到了同样的错误,批处理作业使用类似的结构调用服务以发送JMS消息(通过CDI注入的JMS资源)。
function getDownloadStream(Bucket, Key) {
return s3
.getObject({
Bucket,
Key
})
.on('error', (error) => {
console.error(error);
return Promise.reject(`S3 Download Error: ${error}`);
})
.createReadStream();
}
function downloadFile(inputBucket, key, destination) {
return new Promise(function(resolve, reject){
getDownloadStream(inputBucket, key)
.on('end', () => {
resolve(destination);
})
.on('error', reject)
.pipe(fs.createWriteStream(destination));
});
}
在多次发生上述错误之后,批处理作业以与事务超时相关的错误结束:
javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/RemoteJmsXA
...
javax.resource.ResourceException: IJ000655: No managed connections available within configured blocking timeout (30000 [ms])