Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I combine @Asynchronous and Weld/CDI Events and @Observes(during=TransactionPhase.AFTER_COMPLETION) in Glassfish 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?

like image 277
Michael Avatar asked Apr 29 '11 13:04

Michael


1 Answers

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.

like image 168
Martin Andersson Avatar answered Oct 09 '22 13:10

Martin Andersson