Legacy Knowledge Base
公開されました Sep. 10, 2025

NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipArchiveInputStream

Written By

Sorin Pop

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

  • We are putting up commons-io on osgi/module folder so it will be readily available to all modules, on our previous version of Liferay (DXP 2024 Q1.7), the commons-io worked, however now we are updating to the latest DXP quarterly release
  • 2025-05-13 15:30:46.537 ERROR [liferay/document_library_raw_metadata_processor-2][ROOT:47] bundle com.liferay.portal.tika:1.0.29 (397)[com.liferay.portal.tika.internal.configuration.helper.TikaConfigurationHelper(12174)] : The activate method has thrown an exception
    java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipArchiveInputStream
            at java.lang.Class.forName0(Native Method) ~[?:?]
            at java.lang.Class.forName(Class.java:534) ~[?:?]
            at java.lang.Class.forName(Class.java:513) ~[?:?]

Environment

  • 2025.q1

Resolution

  • the issue seems to be related to a classloading conflict between the manually deployed commons-io library and the internal Tika library used by Liferay. The error java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipArchiveInputStream indicates that the com.liferay.portal.tika bundle cannot find the necessary class from the commons-compress library, likely due to an incompatible version being loaded from the manually deployed commons-io.
     
    Since commons-io is used by other custom modules you have developed,  I understand that simply removing it is not ideal.  I suggest to create a dedicated OSGi module for commons-io and its dependencies, including commons-compress. This isolates the library and prevents conflicts with Liferay's internal dependencies. Use the correct versions of commons-io and commons-compress required by your modules and ensure proper package imports and exports in the module's bnd.bnd file. This approach allows you to keep commons-io globally available while resolving the conflict.
     
    Steps to create a dedicated OSGi module:
    1. Create a new Liferay module project using Blade CLI or Liferay Developer Studio.
    2. Add the necessary commons-io and commons-compress JARs to the module's /lib folder.
    3. Edit the bnd.bnd file:
      * Add Import-Package statements for any external packages required by commons-io and commons-compress.
      * Add Export-Package statements to expose the org.apache.commons.io and org.apache.commons.compress packages, specifying the correct version numbers.
    4. Build and deploy the module.
     
    This approach ensures that Liferay's Tika bundle uses the correct version of commons-compress provided by your dedicated module, resolving the conflict.
  • the approach above worked for one customer (at the time of writing this article):

    I created a new standalone .jar file importing the commons-io and commons-compress, basing its version to the shared-dependencies-apache-commons. 

    After deploying that, I didn't receive any errors when creating a Virtual Instances and when calling the addCompany() code. This fixed my issue. 

 

 

 

Did this article resolve your issue ?

Legacy Knowledge Base