Legacy Knowledge Base
Published Sep. 4, 2025

Resolving custom class is not serializable and will prevent this session from being replicated errors

Written By

Alfonso Abad

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When a customization stores a session attribute that is not serializable, this error appears in the Liferay logs:

    [ERROR] SerializableSessionAttributeListener - [Name.Of.The.Custom.Class] is not serializable and will prevent this session from being replicated
    

Environment

  • Liferay DXP 7.0+

Resolution

WARNING
The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.

  • This message is expected. SerializableSessionAttributeListener checks each attribute added to the session, and the session.verify.serializable.attribute portal property controls that check:

    Set this to true to allow com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener to test if an added session variable is serializable. Unserializable values stored into the session will cause a session to not replicate if session replication was enabled by the application server.
    Defaults:
        session.verify.serializable.attribute=true
    
  • To resolve the issue, update the customization so every object it stores in the session implements java.io.Serializable. Once it does, the session replicates normally.
  • In case you assume the behavior or don't have session replication configured on the application server and would like to stop seeing the message on the log, you can change said property to false in your portal-ext.properties file. However this is not a permanent solution and will not solve the issue. It only stops the class com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener from verifying session variables.
Did this article resolve your issue ?

Legacy Knowledge Base