[
https://issues.apache.org/jira/browse/TOMEE-4333?focusedWorklogId=919659&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-919659
]
ASF GitHub Bot logged work on TOMEE-4333:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 16/May/24 09:07
Start Date: 16/May/24 09:07
Worklog Time Spent: 10m
Work Description: rzo1 commented on PR #1138:
URL: https://github.com/apache/tomee/pull/1138#issuecomment-2114620928
I just queued a full build for it :)
Issue Time Tracking
-------------------
Worklog Id: (was: 919659)
Time Spent: 0.5h (was: 20m)
> NotSerializableException with @Inject HttpServletRequest
> --------------------------------------------------------
>
> Key: TOMEE-4333
> URL: https://issues.apache.org/jira/browse/TOMEE-4333
> Project: TomEE
> Issue Type: Bug
> Affects Versions: 10.0.0-M1, 9.1.3
> Reporter: Jonathan Gallimore
> Assignee: Jonathan Gallimore
> Priority: Major
> Fix For: 10.0.0-M2, 9.1.4
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Given this CDI Bean:
> @SessionScoped
> @Named
> public class MyPageBean implements Serializable {
> @Inject private HttpServletRequest req;
> ... use the bean somewhere in EL
> }
> This will result in an exception when serializing the Session (For session
> replication or passivation): java.lang.RuntimeException:
> java.lang.RuntimeException:
> [java.io|http://java.io/].NotSerializableException:
> org.apache.openejb.cdi.Proxys$ThreadLocalHandler
> From: [https://www.mail-archive.com/[email protected]/msg18097.html]
> Looking at the Proxys.java code, it contains a private static class called
> ThreadLocalHandler, that is indeed not Serializable. For fun, I made
> ThreadLocalHandler implement Serializable, but that just resulted in
> another error because ThreadLocalHandler contains a ThreadLocal field which
> is definitely not Serializable.
> ThreadLocalHandler for HttpServletRequest is invoked by
> TomcatWebappBuilder.setComponentsUsedByCDI():
> [https://github.com/apache/tomee/blob/tomee-8.x/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java#L358]
> I'm at a bit of a loss on how to fix this. My assumption is the
> ThreadLocalHandler was designed as a generic proxy object that defers to an
> internal ThreadLocal object. I wonder if marking the ThreadLocal as
> transient is sufficient, but I could use some input.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)