openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars-Fredrik Smedberg <itsme...@gmail.com>
Subject Re: Injecting beans in listeners
Date Thu, 15 May 2014 18:24:46 GMT
Hi Eric

I tried to call the business method on the injected application scoped bean
from the contextInitialized method in the ServletContextListener, thats
when I get the ContextNotActiveException.

I also tried to fire an event in the contextInitialized method and have the
application scoped bean observe the same event. This causes a printout on
the console saying that it cannot send the event to the bean (I do not
remember the exact message on the console).

I tried the same code in TomEE and it works and if I understand the CDI 1.0
spec correctly there should be an active application context in the
contextInitialized method of the ServletContextListener.

Regards
Lars-Fredrik Smedberg


On Thu, May 15, 2014 at 1:54 AM, Eric Covener <covener@gmail.com> wrote:

> On Wed, May 7, 2014 at 4:50 AM, Lars-Fredrik Smedberg
> <itsmeden@gmail.com> wrote:
> > We are able to @Inject an @ApplicationScoped bean in a
> > RequestContextListener but when we try to @Inject it in a
> > ServletContextListener we get a ContextNotActiveException when accessing
> any
> > business methods in the injected bean.
>
> When do you call the business methods?
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Mime
View raw message