[weld-dev] How to inject in servlet CDI beans from war/lib?

Matej Novotny manovotn at redhat.com
Tue Mar 6 07:02:20 EST 2018


Hi Alex,

could you share your code?
Or, ideally, a reproducer?

Your scenario sounds valid to me and so does your deployment.
But I suppose there is a catch somewhere which I cannot glance from just the description.

Regards,
Matej

----- Original Message -----
> From: "Alex Sviridov" <ooo_saturn7 at mail.ru>
> To: "weld-dev" <weld-dev at lists.jboss.org>
> Sent: Tuesday, March 6, 2018 12:10:51 PM
> Subject: [weld-dev] How to inject in servlet CDI beans from war/lib?
> 
> Hi all.
> 
> Could anyone help me with the following problem. I have a war that contains
> one servlet.
> In WEB-INF of the war I have beans.xml. Besides, inside this war, in lib
> folder I have
> a jar archive. Jar archive has beans.xml in META-INF.
> 
> I use GlassFish 5 that uses Weld. When I want to inject in servlet CDI bean
> from jar,
> container doesn't inject anything - field is null, and no errors I get.
> However, when
> I inject in servlet EJB bean everything works fine.
> 
> How to fix it?
> 
> --
> Best regards, Alex Sviridov
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev


More information about the weld-dev mailing list