You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "kranthi (Jira)" <ji...@apache.org> on 2024/03/17 15:22:00 UTC

[jira] [Created] (COMPRESS-673) ArchiveStreamFactory().createArchiveOutputStream throws class not found exception

kranthi created COMPRESS-673:
--------------------------------

             Summary: ArchiveStreamFactory().createArchiveOutputStream throws class not found exception
                 Key: COMPRESS-673
                 URL: https://issues.apache.org/jira/browse/COMPRESS-673
             Project: Commons Compress
          Issue Type: Bug
          Components: Archivers
         Environment: Mac OS X
            Reporter: kranthi


From common-compress 1.26.0 onwards, createArchiveOutputStream throws java.lang.ClassNotFoundException exception

 

My Code:

-------------------
Path f = Paths.get("/Users/kraas/Documents/test.jar");

ArchiveOutputStream jos = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, Files.newOutputStream(f));
---------------------

The above code, does not throw an error and completes successfully with commons-compress-1.24.0.jar



But starting from commons-compress-1.26.0.jar, below exception is thrown

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/Charsets
    at org.apache.commons.compress.archivers.zip.ZipEncodingHelper.getZipEncoding(ZipEncodingHelper.java:51)
    at org.apache.commons.compress.archivers.zip.ZipEncodingHelper.<clinit>(ZipEncodingHelper.java:37)
    at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.<init>(ZipArchiveOutputStream.java:332)
    at org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveOutputStream(ArchiveStreamFactory.java:518)
    at org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveOutputStream(ArchiveStreamFactory.java:500)
    at work.ArchiveExample.compressZip(ArchiveExample.java:26)
    at work.ArchiveExample.main(ArchiveExample.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.Charsets
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 7 more



--
This message was sent by Atlassian Jira
(v8.20.10#820010)