Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加密war包无法运行 #19

Open
TurboTu opened this issue Apr 25, 2019 · 4 comments
Open

加密war包无法运行 #19

TurboTu opened this issue Apr 25, 2019 · 4 comments

Comments

@TurboTu
Copy link

TurboTu commented Apr 25, 2019

Exception in thread "main" java.lang.IllegalStateException: Failed to get nested archive for entry WEB-INF/lib/netty-codec-4.1.34.Final.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 io.xjar.boot.XWarLauncher.launch(XWarLauncher.java:25)
	at io.xjar.boot.XWarLauncher.main(XWarLauncher.java:21)
Caused by: java.io.IOException: Unable to open nested jar file 'WEB-INF/lib/netty-codec-4.1.34.Final.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)
	... 5 more
Caused by: java.lang.IllegalStateException: Unable to open nested entry 'WEB-INF/lib/netty-codec-4.1.34.Final.jar'. It has been compressed and nested jar files must be stored without compression. Please check the mechanism used to create your executable jar file
	at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:284)
	at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:264)
	at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:252)
	... 7 more

Springboot 打的war包

public class EncryptMyJar {
    public static void main(String[] args) throws Exception {
        String pwd = "123456";

        System.out.println("start");

        File plaintext = new File("a.war");
        File encrypt = new File("b.war");

        System.out.println("middle");

        XBoot.encrypt(
                plaintext,
                encrypt,
                pwd,
                (entry) -> {
                    String name = entry.getName();
                    System.out.println("entry");
                    System.out.println(name);
                    String pkg = "WEB-INF/classes/com/a/b";
//                    String pkg = "WEB-INF/classes/com/a/b";
                    return name.startsWith(pkg);
                }
        );

        System.out.println("end");
    }
}
@core-lib
Copy link
Owner

是spring boot 项目吗

@TurboTu
Copy link
Author

TurboTu commented Apr 25, 2019

对的

@TurboTu
Copy link
Author

TurboTu commented Apr 25, 2019

war包是maven打包的

@core-lib
Copy link
Owner

看下你的打包配置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants