Re: Please help: CDI definition failure:WELD-000409: Observer method for container lifecycle event

From: arjan tijms <>
Date: Fri, 11 Sep 2015 22:07:00 +0200


On Fri, Sep 11, 2015 at 9:47 PM, Edward Burns <> wrote:
> AT> It's a kind of regression between JDK8 update 60 and Weld. At least
> AT> from the side of Weld it's logged as a bug a subsequently fixed.
> Thanks for your super responsive reply. I appreciate it.

No probs ;)

> AT> There are 3 solutions currently:
> AT> 1. Don't compile with JDK8 u60 (can run with that, just don't use it
> AT> for compiling)
> I'll try that, thanks.
> AT> 2. Update Weld
> Is there a new Weld version that has the fix for this?

It's fixed in Weld 2.2.16.Final and Weld 2.3.0.CR2. Only the latter
has a build published it seems. Not sure if 2.2.16.Final was forgotten
or just delayed.

See for the issue and for the downloads.

> AT> 3. Don't use lambdas in these observer methods
> That's the thing, my code doesn't even use CDI. Isn't this problem in
> the RI?

It's not specifically the fault of the RI, but the RI does have a
method with a lambda used in it and a method parameter with an
@Observers annotation. Because of the lambda the JDK generates a
method inside the class that CDI now picks up, which it shouldn't (and
it's questionable if the JDK should put a visible annotation on such
generated method).

It's not just something specifically for the RI either. See for an other example.

Kind regards,
Arjan Tijms

> Ed
> --
> | | office: +1 407 458 0017
> | 39 Business days til JavaOne 2015
> | 54 Business days til DOAG 2015