Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIAttributes must be serializable #337

Open
gdressino opened this issue Jun 19, 2020 · 1 comment
Open

UIAttributes must be serializable #337

gdressino opened this issue Jun 19, 2020 · 1 comment
Labels

Comments

@gdressino
Copy link

gdressino commented Jun 19, 2020

I'm getting this error because com.github.appreciated.app.layout.session.UIAttributes is not serializable but that class access and stores an instance of it in the user session.

When using jetty, the session cannot be serialized because of this error:

	at org.eclipse.jetty.server.session.FileSessionDataStore.doStore(FileSessionDataStore.java:331)
	at org.eclipse.jetty.server.session.AbstractSessionDataStore$1.run(AbstractSessionDataStore.java:142)
	at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1382)
	at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1401)
	at org.eclipse.jetty.server.session.SessionContext.run(SessionContext.java:92)
	at org.eclipse.jetty.server.session.AbstractSessionDataStore.store(AbstractSessionDataStore.java:155)
	at org.eclipse.jetty.server.session.AbstractSessionCache.release(AbstractSessionCache.java:566)
	at org.eclipse.jetty.server.session.SessionHandler.complete(SessionHandler.java:368)
	at org.eclipse.jetty.server.Request.leaveSession(Request.java:399)
	at org.eclipse.jetty.server.Request.onCompleted(Request.java:1531)
	at org.eclipse.jetty.server.HttpChannel.onCompleted(HttpChannel.java:732)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:363)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.NotSerializableException: com.github.appreciated.app.layout.session.UIAttributes
	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1185)
	at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
	at java.base/java.util.HashMap.internalWriteEntries(HashMap.java:1840)
	at java.base/java.util.HashMap.writeObject(HashMap.java:1411)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1145)
	at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
	at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
	at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
	at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1510)
	at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
	at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
	at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1510)
	at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
	at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
	at org.eclipse.jetty.server.session.SessionData.serializeAttributes(SessionData.java:116)
	at org.eclipse.jetty.server.session.FileSessionDataStore.save(FileSessionDataStore.java:479)
	at org.eclipse.jetty.server.session.FileSessionDataStore.doStore(FileSessionDataStore.java:324)
	... 23 more

Remember that objects stored in HttpSession should be Serializable.

@gdressino gdressino added the bug label Jun 19, 2020
@kyberorg
Copy link

I will add that com.github.appreciated.app.layout.session.UIAttributes causes OutOfMemory exception in my app.

Screenshot_20201228_134416

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants