Legacy Knowledge Base
Published Sep. 10, 2025

Unable to cast String to Long error during upgrade

Written By

Marco Abamonga

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 upgrading from Liferay DXP 7.2 to 2025.Q1, setting the fileMaxSize property in the com.liferay.document.library.configuration.DLConfiguration.config file causes an "Unable to cast String to Long" error. The upgrade tool fails with this error because the fileMaxSize property expects a Long value, but the configuration file may contain a String value if not correctly configured.
2025-04-23 18:16:43.737 ERROR [main][UpgradeExecutor:333] Failed upgrade process for module com.liferay.document.library.service com.liferay.portal.kernel.upgrade.UpgradeException: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Long (java.lang.String and java.lang.Long are in module java.base of loader 'bootstrap')

Environment

  • Liferay DXP 7.2
  • Liferay DXP 2025.Q1 (Quarterly Release)
  • MySQL

Resolution

To resolve the issue and ensure a successful upgrade, configure the fileMaxSize property with a Long value by appending L to the numeric value. The following steps outline the correct procedure:
  1. DXP 7.2 Configuration: In your Liferay DXP 7.2 instance, locate the com.liferay.document.library.configuration.DLConfiguration.config file within the osgi/configs folder. Set the desired fileMaxSize value by adding "L" after the number, enclosed in quotes. For instance, to set a maximum file size of 20MB, use: fileMaxSize=L"20971520"
  2. DXP 2025.Q1 Configuration: Similarly, in your Liferay DXP 2025.Q1 instance, locate or create the com.liferay.document.library.configuration.DLConfiguration.config file in the osgi/configs folder. Configure the fileMaxSize property using the same format as in the previous step. Ensure the value matches the one set in your 7.2 instance. For example: fileMaxSize=L"20971520"
  3. Upgrade Process: After configuring both instances, proceed with running the upgrade tool. The upgrade should complete without the "Unable to cast String to Long" error.

    This approach ensures that both your existing 7.2 instance and the target 2025.Q1 instance have the fileMaxSize property correctly configured as a Long value. By following these steps, the upgrade process can successfully handle the property and prevent the casting error.

Alternatively, you can set the maximum file size in the Control Panel UI instead of a config file:

  1. DXP 7.2 Configuration: In your Liferay DXP 7.2 instance, go to Control Panel> System Settings >Documents and Media> File Size Limits>Maximum File Upload Size
  2. Adjust the value
  3. Save the changes
  4. Shut down the Liferay DXP 7.2 instance
  5. Upgrade Process: Proceed with running the upgrade tool

 

 

Did this article resolve your issue ?

Legacy Knowledge Base