]
Martin Kouba resolved WFLY-9665.
--------------------------------
Resolution: Won't Do
HttpSession cannot be injected in distributed application
---------------------------------------------------------
Key: WFLY-9665
URL:
https://issues.jboss.org/browse/WFLY-9665
Project: WildFly
Issue Type: Bug
Components: CDI / Weld, EE
Affects Versions: 10.1.0.Final
Reporter: Zoltan Laszlo Ferenci
Assignee: Martin Kouba
Attachments: HttpSessionInjectionBug.zip
The CDI Specification states that HttpSession should be available for injection. It also
has statements about when should the bean passivation capable.
The problem is that it seems the io.undertow.servlet.spec.HttpSessionImpl is not
serializable, and whenever you try to inject, you get exception at passivation.
I would say it's normal if it's injected into a passivating scoped bean, because
the CDI specification says that the bean is passivation capable only if all it's
dependencies is passivation capable.
However this is the case even if it's injected in a RequestScoped bean, that
shouldn't be passivated. In the sample project only the HttpSession should be
passivated that is independent from the CDI. Anyway it gives an error in that case too,
and doesn't store and recover the HttpSession.