如何在Glassfish 3.1中结合@Asynchronous和Weld / CDI事件和@Observes(at = TransactionPhase.AFTER_COMPLETION) [英] How do I combine @Asynchronous and Weld/CDI Events and @Observes(during=TransactionPhase.AFTER_COMPLETION) in Glassfish 3.1

查看:578
本文介绍了如何在Glassfish 3.1中结合@Asynchronous和Weld / CDI事件和@Observes(at = TransactionPhase.AFTER_COMPLETION)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先让我声明,以下代码示例在GF 3.0.1中工作正常。当我们切换到GF 3.1时,麻烦就开始了。



我正在使用一种方法

 code> @Asynchronous 
public void executeFlowStep(
@Observes(during = TransactionPhase.AFTER_COMPLETION)
ExecuteFlowStepEvent executeFlowStepEvent){

由于交换机,每当这样收到一个 ExecuteFlowStepEvent ,我会收到以下错误消息:

  WELD-000401通知观察者事件[package]时失败.ExecuteFlowStepEvent 

没有给出进一步的信息或堆栈跟踪。
如果我删除 @Asynchronous 注释和 AFTER_COMPLETION 属性,那么这样做会打破程序因为我依赖于 AFTER_COMPLETION 时间。



我试图向焊工论坛寻求帮助,到目前为止尽管似乎还有其他人遇到同样的问题: http://seamframework.org/Community/WeldUsers



我至少想知道:
这是一个bug,还是这个想要的。这是否意味着Weld不能使用异步方法/ AFTER_COMPLETION属性?为什么在GF 3.0.1中工作?
有没有人设法在GF 3.1上做这个工作?

解决方案

根据链接您作为对自己的问题的评论发布,这是一个在Wield 1.1.2和GlassFish 3.1中修复的错误.2(build 14 +)。



disclamer :我将这个答案发布到一个年龄小的问题,以帮助SO(StackOverflow)摆脱未回答的问题。


First of all let me state, that the following code example worked just fine in GF 3.0.1. The troubles started when we switched to GF 3.1.

I'm using a method

@Asynchronous
public void executeFlowStep(
    @Observes(during=TransactionPhase.AFTER_COMPLETION) 
    ExecuteFlowStepEvent executeFlowStepEvent) { 

Since the switch, whenever this should receive an ExecuteFlowStepEvent I get the following error message:

WELD-000401 Failure while notifying an observer of event [package].ExecuteFlowStepEvent

No further information or stacktrace is given. It works if I remove the @Asynchronous annotation and the AFTER_COMPLETION attribute, of course this breaks the program as I depend on the AFTER_COMPLETION timing.

I tried to ask for help on the Weld Forums, so far to no avail, although there seem to be other people with the same problem: http://seamframework.org/Community/WeldUsers

I at least would like to know: Is this a bug, or is this wanted. Does this imply that Weld does NOT work with Asynchronous methods/AFTER_COMPLETION attributes? Why did this work in GF 3.0.1? Has anyone managed to make this work on GF 3.1?

解决方案

According to the link you posted as a comment to your own question, this is a bug that was fixed in Wield 1.1.2 and GlassFish 3.1.2 (build 14+).

disclamer: I posted this answer to an age old question to help SO (StackOverflow) get rid of unanswered questions.

这篇关于如何在Glassfish 3.1中结合@Asynchronous和Weld / CDI事件和@Observes(at = TransactionPhase.AFTER_COMPLETION)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆