users@glassfish.java.net

Re: EJB with CDI observer method: observer method never fires

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Wed, 18 Dec 2013 15:28:07 -0800

On Wed, Dec 18, 2013 at 2:47 PM, Laird Nelson <ljnelson_at_gmail.com> wrote:

> What am I missing or doing wrong?
>

The event I am observing is a lifecycle event of the container
(ProcessSessionBeanEvent). It turns out that the CDI specification in
section 11.5 says my observer method must therefore belong to an extension
for events of that type to be delivered to any observer methods on it.

If I simply add "implements Extension" to my bean, then the event fires
(yay!), but GlassFish croaks because Weld tries to invoke my bean's proxy
before the container has finished initializing.

Looks like it will be much simpler...I guess? to create an Extension class
specially built for this, and to then @Inject it in an EJB afterwards if I
need to ask it to do other things after startup.

Best,
Laird

-- 
http://about.me/lairdnelson