Add more than 65535 entries jar in Spring boot

I created a custom semantic similarity between sentences algorithm. Project created 65535 entries jar as it contains 100,000 words. I added custom jar to my spring boot project using "mvn install:install-file" and created boot jar, but whenever i run project i am getting this error.

Exception in thread "main" java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/semantics-1.0.jar
    at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:109)
    at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:87)
    at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:72)
    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/semantics-1.0.jar'
    at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:252)
    at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:237)
    at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:104)
    ... 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:91)
    at org.springframework.boot.loader.jar.CentralDirectoryParser.visitStart(CentralDirectoryParser.java:88)
    at org.springframework.boot.loader.jar.CentralDirectoryParser.parse(CentralDirectoryParser.java:56)
    at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:118)
    at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:106)
    at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:290)

 at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:260)
    at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:248)
    ... 6 more 

See https://github.com/spring-projects/spring-boot/issues/2895

The key error is:

Caused by: java.lang.IllegalStateException: Zip64 archives are not supported

55mb does not require the Zip64 format, you probably should change how you create your file.

Gradle + Spring Boot can't handle jars with more than 65535 files , Gradle + Spring Boot can't handle jars with more than 65535 files - gradle. archive contains more than 65535 entries. To build this archive, please compiled into. To fix this issue, add package app.main to the top of the Application.kt file. When I apply the shadowJar task, then the "archive contains more than 65535 entries" was raised, I put this information here. Following is the detailed message: FAILURE: Build failed with an exception.

Spring boot will not support more than 65534 files in the jar. Here is the their code.

public int getNumberOfRecords() {
        long numberOfRecords = Bytes.littleEndianValue(this.block, this.offset + 10, 2);
        if (numberOfRecords == 0xFFFF) {
            throw new IllegalStateException("Zip64 archives are not supported");
        }
        return (int) numberOfRecords;
    }

Since its data file, keep it outside jar, which will reduce the build time as well.

spring-projects/spring-boot, I created a small application and put it on Github to help you help me with this. IllegalStateException: No 'Start-Class' manifest entry specified in jar:file:. This third party jar has more than 65535 files and so Spring Boot  It is impossible to store the actual number of entries in the table of contents, since there are only 16 bits available. So Zip files with more than 64k entries are simply corrupted -- the metadata cannot be correct. jar cf should keep count of the number of entries, and throw an exception if an attempt is made to add more than 64k.

Spring boot 2.2 will support zip64 jars Github issue

spring-projects/spring-boot, This is a known limitation; Spring Boot's Loader doesn't support the zip64 format. counting your jar if they are more than 65535 entries may be an option if we i want to add a filter that is only invoked when a certain url pattern is matched. Spring Boot is a huge success, perhaps even more so than its inceptors hoped for. There is a lot of documentation, blog posts, and presentations on Spring Boot. However, most of them are aimed toward a feature, like monitoring or configuring. Few - if any of them, describe real-world practices. In this post, I’d like to highlight how to design a Spring Boot having multiple modules.

I know it is not a good practice but my spring project is working fine now as I included my dependencies whole package to spring project rather than creating a jar of that dependency and then importing it.

hadoop - Gradle archive contains more than 65535 entries -, spring-boot-1.2.7 release. getting error while including this 1)archive contains more 65535 entries. my gradle jar dependency jar{  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

The Executable Jar Format, The spring-boot-loader modules lets Spring Boot support executable jar and war files. Armed with this information, we can load specific nested entries by You can add extra jars in those locations if you want more. then ${loader.home}/lib is a classpath location (along with all jar files in that directory). This single jar didn't had any nested jars. But still while running the app using "java -jar abc.jar" i still get same exception. I think the spring loader still checks number of files in this single jar, which in my case are more than 65535 as the fat jar was unpacked in this single jar.

Getting Started, However, Spring Boot does more than that. but also lets you put together executable JARs, thanks to Spring  The generated properties file is "computed" (it contains all the transitive dependencies), so if you have that, the dependencies from the pom.xml will be ignored.. If you look at the jar file produced by the build you will see that it is "thin" (a few KB), but executable with java -jar .

Gradle 2.3, I created a small application and put it on Github to help you help me Packing the same app again will fail because in the second time there is more than 65535 files. Then I set the zip64 property to true (I had to do it in the jar { } task getMainClass(Archive.java:57) at org.springframework.boot.loader. In this tutorial, we'll explore the differences between starting a Spring Boot web application via the mvn spring-boot:run command and running it after it is compiled into a jar/war package via the java -jar command. Let's assume here you're already familiar with the configuration of the Spring Boot repackage goal.

Comments
  • If I correctly understand, it is DATA (i.e. not java code), so why jar is required? ... BTW i create 1GB Zip by Java (slow, but works)
  • yes it is data, not java code. It is very cumbersome if your build take 3 hours to compile every time you change your code. Any suggestion can help here
  • Zip64 archives are not supported create a normal zip/jar instead?
  • Edited my question. Kindly review now.
  • I'd seriously reconsider how you're dealing with your data.