Free Support Forum - groupdocs.com

GroupDocs jar cannot be read from springboot fat executable JAR


#1

Hi,
I am using GroupDocs viewer in my springboot application.
After packaging springboot application as a JAR I am trying to launch the application using java -jar command.
It fails with the error -
Exception in thread “main” java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/groupdocs-viewer-18.6.2.jar

Same error for, GroupDocs comparison jar too.
Below is the full error -

Exception in thread “main” java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/groupdocs-comparison-18.6.2.jar
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:108)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:86)
at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:70)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.io.IOException: Unable to open nested jar file ‘BOOT-INF/lib/groupdocs-comparison-18.6.2.jar’
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:256)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:241)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:103)
… 4 more
Caused by: java.lang.IllegalStateException: Zip64 archives are not supported
at org.springframework.boot.loader.jar.CentralDirectoryEndRecord.getNumberOfRecords(CentralDirectoryEndRecord.java:124)
at org.springframework.boot.loader.jar.JarFileEntries.visitStart(JarFileEntries.java:120)
at org.springframework.boot.loader.jar.CentralDirectoryParser.visitStart(CentralDirectoryParser.java:89)
at org.springframework.boot.loader.jar.CentralDirectoryParser.parse(CentralDirectoryParser.java:57)
at org.springframework.boot.loader.jar.JarFile.(JarFile.java:123)
at org.springframework.boot.loader.jar.JarFile.(JarFile.java:111)
at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:289)
at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:264)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:252)
… 6 more


#2

@nirajsingh24,

Thanks for posting your inquiry.

We have tried running GroupDocs.Viewer for Java - Spring application from a packaged JAR but unable to reproduce your reported issue at our end. In case you have updated the pom.xml at your end, please share that with us. We shall be looking forward to your response.


#3

pom.zip (1.3 KB)
Attaching POM here.

I build my application JAR using -
mvn clean install

Then I try to run the application using -
java -jar jarname

It gives error mentioned in my first comment.


#5

@nirajsingh24,

We are able to reproduce your reported issue at our end. We have logged it in our Issue Tracking System as VIEWERJAVA-1886 for further investigation. We shall notify you as soon as we get any updates for you.


#6

@nirajsingh24,

We have got the updates regarding your reported exception. GroupDocs.Viewer for Java’s JAR is a Zip64 archive which is not supported by Spring Boot’s Loader and therefore, the exception Zip64 archives are not supported is thrown at your end. Hence, this issue is generic for all Zip64 archives and is not related to GroupDocs.Viewer for Java API.


#7

Hi,
Is there a workaround? I am stuck on it.
Are there other people using GroupDocs JARs with Spring Boot? I tried to find out a solution but haven’t gotten yet. Does this mean GroupDocs JARs cannot be used with Spring Boot due to this limitation?

Spring Boot forum advises to break the big JARs into nested JARs to avoid this problem. Do you guys want to consider this solution as most of the GroupDOcs JAR seem to be ZIP64?
Thanks


#8

@nirajsingh24,

Yes, GroupDocs JARs can be used with the Spring Boot application. For reference, you can download and try our Spring Boot application that uses GroupDocs.Viewer for Java at the back-end. The application can be downloaded from here.

Furthermore, we also noticed that using spring-boot-maven-plugin (that you have used in your pom.xml) in our Spring Boot application raises Zip64 archives are not supported exception. However, using maven-compiler-plugin instead of spring-boot-maven-plugin in the pom.xml resolves this issue. Hope this workaround helps you.