Exception in thread "main" java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/fastjson-1.2.83.jar
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:113)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:87)
at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:69)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.io.IOException: Unable to open nested jar file 'BOOT-INF/lib/fastjson-1.2.83.jar'
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:261)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:247)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:109)
... 4 more
Caused by: java.lang.IllegalStateException: Unable to open nested entry 'BOOT-INF/lib/fastjson-1.2.83.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:287)
at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:269)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:258)
... 6 more
最近修复fastjson漏洞,出完方案后,现场同事替换jar包中对应lib包下的fastjson低版本包,通过java -jar启动项目报错。
解决方法如下:
1)解压jar包:
jar -xvf testDemo-0.0.1-SNAPSHOT.jar
2)替换文件
3)压缩jar包:
jar -cfM0 testDemo-0.0.1-SNAPSHOT.jar ./