Foros de discusión

Cannot serialize session attribute

Riley Pickerl, modificado hace 10 años.

Cannot serialize session attribute

Junior Member Mensajes: 50 Fecha de incorporación: 10/01/13 Mensajes recientes
Hello,

I have a liferay portlet with vaadin that uses IPC to send data to another porltet on the screen. Both the sending and receiving IPC portlets give me this cannot serialize session attribute.
However the IPC workflow still seems to work. I was wondering if anyone knows how to get rid of this warning.
I have created many other portlets similar to this one and not recieved this error.
I only receive this error when I redeploy the portlet. If I deploy onto a server fresh I do not get the warning.

WARNING: Cannot serialize session attribute javax.portlet.pselector_WAR_.._INSTANCE_g5gqe5J1TI2f_LAYOUT_14601?com.vaadin.terminal.gwt.server.PortletApplicationContext2 for session 3076268BD272BB095044087363C0E7DD
java.io.NotSerializableException: com.liferay.portlet.PortletConfigImpl
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
	at java.util.HashMap.writeObject(HashMap.java:1000)
	at sun.reflect.GeneratedMethodAccessor443.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:940)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
	at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1671)
	at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1077)
	at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:432)
	at org.apache.catalina.session.StandardManager.unload(StandardManager.java:353)
	at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:518)
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
	at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5462)
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
	at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1357)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1454)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1379)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1537)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1547)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1526)
	at java.lang.Thread.run(Thread.java:662)


Any ideas or advise would be appreciated!

Thanks in advance.
thumbnail
David H Nebinger, modificado hace 10 años.

RE: Cannot serialize session attribute

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Well, PortletConfigImpl is not serializable, that is normal. The question is really what you're sending via IPC and how you're doing it...
Janus Godard, modificado hace 10 años.

RE: Cannot serialize session attribute

New Member Mensajes: 17 Fecha de incorporación: 1/08/13 Mensajes recientes
I don't think it's related to the IPC, I have the same issue with my Vaadin portlet.
This might be related to this passage of the book of Vaadin:
In addition to the Vaadin library, you will need to copy the portlet.jar to your project. Notice that you must not put the portlet.jar in the same WebContent/WEB-INF/lib directory as the Vaadin JAR or otherwise include it in the WAR to be deployed, because it would create a conflict with the internal portlet library of the portal. The conflict would cause errors such as "ClassCastException: ...ApplicationPortlet2 cannot be cast to javax.portlet.Portlet".
thumbnail
David H Nebinger, modificado hace 10 años.

RE: Cannot serialize session attribute

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Well first I can tell you that none of my Vaadin portlets have the portlet.jar file in them, and they all work fine.

Second, and more importantly, if you're not putting a jar in WEB-INF/lib, it's not going to be used/referenced at all. The web container's class loader doesn't pluck jar files from anywhere under the WEB-INF directory, it will only use WEB-INF/lib (and subdirs). If you put it anywhere under here (so it's available), you get the other exceptions due to class loader issues.
Eric Smith, modificado hace 9 años.

RE: Cannot serialize session attribute

Junior Member Mensajes: 66 Fecha de incorporación: 28/08/12 Mensajes recientes
Janus,

Did you solve this problem?

We're seeing the same exception in the logs when we shutdown Liferay. It happens with most or maybe all our Vaadin portlets (all of which use IPC).

Thanks.

Eric
Account Removed, modificado hace 8 años.

RE: Cannot serialize session attribute

New Member Mensajes: 9 Fecha de incorporación: 19/02/15 Mensajes recientes
among the the possible reasons for the WARNING could be the Tomcat killing the context (due to the portlet undeploy or overall server stop). Tomcat is then attempting to persist all the objects in sessions, but not all of them seem to implement serializable...

there are ways to disable session persistence feature:
http://tomcat.apache.org/tomcat-5.5-doc/config/manager.html