如何在 Glassfish 3.1 中结合 @Asynchronous 和 Weld/CDI 事件以及 @Observes(during=TransactionPhase.AFTER_COMPLETION)
首先我要声明,下面的代码示例在 GF 3.0.1 中运行得很好。当我们切换到 GF 3.1 时,麻烦就开始了。
我正在使用一种方法
@Asynchronous
public void executeFlowStep(
@Observes(during=TransactionPhase.AFTER_COMPLETION)
ExecuteFlowStepEvent executeFlowStepEvent) {
,自从切换以来,每当该方法接收 ExecuteFlowStepEvent 时,我都会收到以下错误消息:
WELD-000401 Failure while notifying an observer of event [package].ExecuteFlowStepEvent
没有给出进一步的信息或堆栈跟踪。 如果我删除 @Asynchronous 注释和 AFTER_COMPLETION 属性,它会起作用,当然这会破坏程序,因为我依赖于 AFTER_COMPLETION 计时。
我尝试在 Weld 论坛上寻求帮助,但到目前为止没有成功,尽管似乎还有其他人也遇到了同样的问题: http://seamframework.org/Community/WeldUsers
我至少想知道: 这是一个错误,还是这是想要的。这是否意味着 Weld 不适用于异步方法/AFTER_COMPLETION 属性?为什么这在 GF 3.0.1 中有效? 有人设法在 GF 3.1 上实现此功能吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您作为对自己问题的评论发布的链接,这是一个错误已在 Wield 1.1.2 和 GlassFish 3.1.2(build 14+)中修复。
免责声明:我发布了这个古老问题的答案,以帮助 SO (StackOverflow) 摆脱未解答的问题。
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.