Question

I want to use TrueZIP 7.7 library in a server to uncompress user-uploaded archives. I don't plan to work with encrypted archives, and especially, since this is a server, I don't need a Swing popup to ask for a key. Yet when I created some simple test for unzipping a file, it failed with this error:

java.util.ServiceConfigurationError: de.schlichtherle.truezip.key.spi.KeyManagerService: Provider de.schlichtherle.truezip.fs.archive.zip.raes.PromptingKeyManagerService could not be instantiated: java.lang.NoClassDefFoundError: de/schlichtherle/truezip/swing/EnhancedPanel
        at java.util.ServiceLoader.fail(ServiceLoader.java:207)
        at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:421)
        at de.schlichtherle.truezip.key.sl.KeyManagerLocator$Boot.<clinit>(KeyManagerLocator.java:60)
        at de.schlichtherle.truezip.key.sl.KeyManagerLocator.get(KeyManagerLocator.java:41)
        at de.schlichtherle.truezip.key.AbstractKeyManagerProvider.get(AbstractKeyManagerProvider.java:22)
        at de.schlichtherle.truezip.fs.archive.zip.KeyController.getKeyManager(KeyController.java:62)
        at de.schlichtherle.truezip.fs.archive.zip.KeyController.sync(KeyController.java:129)
        at de.schlichtherle.truezip.fs.FsDecoratingController.sync(FsDecoratingController.java:131)
        at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController.sync(FsFalsePositiveArchiveController.java:480)
        at de.schlichtherle.truezip.fs.FsManager.sync(FsManager.java:105)
        at de.schlichtherle.truezip.fs.FsDefaultManager.sync(FsDefaultManager.java:190)
        at de.schlichtherle.truezip.fs.FsSyncShutdownHook$Hook.run(FsSyncShutdownHook.java:93)
Caused by: java.lang.NoClassDefFoundError: de/schlichtherle/truezip/swing/EnhancedPanel
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at de.schlichtherle.truezip.fs.archive.zip.raes.PromptingKeyManagerService.<init>(PromptingKeyManagerService.java:37)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)
        ... 11 more
Caused by: java.lang.ClassNotFoundException: de.schlichtherle.truezip.swing.EnhancedPanel
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 31 more

Is it possible to disable TrueZIP key management completely, or at least make sure it doesn't require any Swing components just to extract a ZIP file?

Was it helpful?

Solution

With TrueZIP, you have to satisfy the dependency of the TrueZIP Driver ZIP on TrueZIP Swing, or otherwise you won't get rid of this exception. As long as your app doesn't encounter WinZip AES encrypted entries, the key manager popup does not appear. You can also implement your own key management by following this article: http://truezip.java.net/truezip-driver/truezip-driver-zip/key-management.html (but you still need to satisfy this dependency).

Alternatively, you could migrate to TrueVFS. TrueVFS has an even more modular architecture where you could simply add the TrueCommons KeyManager Disable module on your class path to get the same effect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top