How do I combine @Asynchronous and Weld/CDI Events and @Observes(during=TransactionPhase.AFTER_COMPLETION) in Glassfish 3.1

谁说胖子不能爱 提交于 2020-01-03 11:30:08

问题


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?


回答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.



来源:https://stackoverflow.com/questions/5832775/how-do-i-combine-asynchronous-and-weld-cdi-events-and-observesduring-transact

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!