We can’t reproduce the problem in simple Gradle project with Java 17, Spring Boot v3.1.5 and GroupDocs.Viewer v23.7.
Could you please provide small simple project where the problem can be reproduced?
Or at least write which GroupDocs.Viewer version is used and provide full console output for analyzing. The problem can be connected to max MANIFEST.MF file size or to something else.
Java Zulu17.46+19-CA, Spring Boot v3.1.5, GroupDocs.Viewer v23.7, IntelliJ IDEA 2023.2.5 (Ultimate Edition).
Yes, I had a problem with “Unsupported size: 22465227 for JarEntry META-INF/MANIFEST.MF”, which sometimes broke the build already during compilation.
I added the recommended parameter:
./gradlew bootJar -Djdk.jar.maxSignatureFileSize=28000000
The build occurs correctly and the executable jar can be launched, despite the message:
"
./gradlew bootJar
Task:compileJava
error: error reading /Users/valentinshuravlov/.gradle/caches/modules-2/files-2.1/com.groupdocs/groupdocs-viewer/23.7/2f4caaaf2dbdb157c428cc63014dec0456a69472/groupdocs-viewer-23.7.jar; Unsupported size: 22465227 for JarEntry META-INF/MANIFEST.MF. Allowed max size: 8000000 bytes
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
When I run:
"
./gradlew bootRun -Djdk.jar.maxSignatureFileSize=28000000
then I get:
Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.example.demo.app.ConvertService] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@531d72ca]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483) ~[spring-core-6.0.13.jar:6.0.13]
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:320) ~[spring-core-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.checkLookupMethods(AutowiredAnnotationBeanPostProcessor.java:459) ~[spring-beans-6.0.13.jar:6.0.13]
… 19 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/groupdocs/viewer/interfaces/FileStreamFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402) ~[na:na]
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504) ~[na:na]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465) ~[spring-core-6.0.13.jar:6.0.13]
…21 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.groupdocs.viewer.interfaces.FileStreamFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[na:na]
…25 common frames omitted
"
Perhaps this is a gradle problem or do you know any recipes?
I have the same issue. I am evaluating your product for use in a new commercial product. Once I see it working, we will subscribe with a paid for license.
I’m not doing a spring boot project, just a simple gradle project. Using gradle 8.4. Here’s my error message:
error reading /Users/bgmoon/.gradle/caches/modules-2/files-2.1/com.groupdocs/groupdocs-viewer/23.11/879d64b7a9ea2d94b546f2e7cba266a4486ba5fc/groupdocs-viewer-23.11.jar; Unsupported size: 22794305 for JarEntry META-INF/MANIFEST.MF. Allowed max size: 16000000 bytes. You can use the jdk.jar.maxSignatureFileSize system property to increase the default value.
I have also tried 23.7 just in case.
I have also cleared my gradle caches and restarted.
I’m building using IntelliJ 23.2.5, Gradle 8.4 and JDK 21 (Azul)
My build.gradle contains this:
maven {
url 'https://repository.groupdocs.com/repo/'
}
// group docs
implementation 'com.groupdocs:groupdocs-viewer:23.11'
I see the JAR file downloaded in to my runtime class path just fine.
@Test
public void viewPDF() {
// Instantiate Viewer
try (Viewer viewer = new Viewer("sample1.pdf"))
{
// Set output HTML options, one file per page
HtmlViewOptions viewOptions =
HtmlViewOptions.forEmbeddedResources();
// Render PDF to HTML with embedded resources
viewer.view(viewOptions);
}
}
Tried downloading your “Demos and Examples” from GitHub to run using the same gradle setup as outlined above.
When I try to run “RunExamples” I get the same error:
error reading /Users/bgmoon/.gradle/caches/modules-2/files-2.1/com.groupdocs/groupdocs-viewer/23.11/879d64b7a9ea2d94b546f2e7cba266a4486ba5fc/groupdocs-viewer-23.11.jar; Unsupported size: 22794305 for JarEntry META-INF/MANIFEST.MF. Allowed max size: 8000000 bytes
I did some digging. It seems the fault is that the signature associated with the Manifest exceeds the maximum size allowed by the JVM (8M for JDK’s from 11 to 20 and 16M for JDK 21.). This change in enforcing the maxim manifest file size was a security issue fixed by the java community.
I have tried every way that I can think of to include this directive in the gradle invocation from IntelliJ, but no joy:
-Djdk.jar.maxSignatureFileSize=32000000
In theory, if I add this to my grade daemon launcher it should allow for a larger signature but as I say, I have not found a way to make this work.
OK, was able to get this to render. In IntelliJ, right click on your main method (with the green arrow) and select “modify run configuration”, then in the “Run” category, select the “Modify options” drop down list and on that list select “Add VM options”. A new field will present on the editor called “VM Options”, and there you can add the JVM parameter: -Djdk.jar.maxSignatureFileSize=25000000
Note at this point, you can “run” the application, but you will still get the error message about reading the manifest file exceeding the maximum file size.
I already did maven clean, maven refresh dependencies. Maven install, or trying to execute the Spring Boot application as usual from my IDE (IntelliJ Idea), even with VM options: -Djdk.jar.maxSignatureFileSize=25000000 or -Djdk.jar.maxSignatureFileSize=100000000,
prints this error to the console:
java: error reading C:\Users\bernardodepc.m2\repository\com\groupdocs\groupdocs-viewer\21.11.1\groupdocs-viewer-21.11.1.jar; Unsupported size: 20806623 for JarEntry META-INF/MANIFEST.MF. Allowed max size: 8000000 bytes
I can see in my C:\Users(...)\.m2\repository\com\groupdocs\groupdocs-viewer\21.11.1 folder that: groupdocs-viewer-21.11.1.jar has 243MB size.
Is this normal?
Do you have any workaround to suggest?
(Contrarily to what user bgmoon suggests, this error is blocking for me. My app does not run)
Thanks @vladimir.litvinchik
I confirm that workaround worked - after doing a Rebuild of the project.
(For some IDE reason probably, when I executed those suggested flags as VM options of my Spring Boot run in IntelliJ IDEa, the blocking error continued to appear. Once I rebuilt it, it started working… )
This issue was fixed in GroupDocs.Viewer for Java 24.4. This version does not require setting -Djdk.jar.maxSignatureFileSize=28000000. Please let us know if you have any questions.
Thanks for the info. Unfortunately, I had problems with version 24.4.
I use the viewer in a spring boot application / gradle.
In the development environment, the application starts fine and works as expected.
When I build an executable jar using build or bootJar, the application crashes with the error:
Caused by: java.lang.IllegalStateException: Failed to introspect Class [de.xm.workbasket.utils.formatconversions.ConvertService] from ClassLoader [org.springframework.boot.loader.launch.LaunchedClassLoader@2a84aee7]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483)
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:320)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.checkLookupMethods(AutowiredAnnotationBeanPostProcessor.java:475)
… 54 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/groupdocs/viewer/options/ViewOptions
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465)
… 56 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.groupdocs.viewer.options.ViewOptions
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:104)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
… 60 common frames omitted
It looks like this is some caching issue. A couple of cleanup and rebuilds typically fixes this this issue. We have planned the investigation. As soon as we have any new information we’ll let you know.