今天把现网版本的task的jar拖回来然后用7-zip打开拖了一个jar进去替换mysql-connector-java-5.1.47.jar 为 mysql-connector-java-5.1.27.jar
启动微服务的时候就报错下面的
Exception in thread "main" java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/mysql-connector-java-5.1.27.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/mysql-connector-java-5.1.27.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: Unable to open nested entry 'BOOT-INF/lib/mysql-connector-java-5.1.27.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:285)
at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:260)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:248)
... 6 more
后来发现问题原因是用7-zip拖进去的jar又被压缩了一次
网上查发现用winrar的 不压缩直接存储的文件 功能可以拖进去而不压缩mysql-connector-java-5.1.27.jar
然后重启task微服务就可以了
注意在把jar拖进去task微服务jar的时候,把要添加的文件 复制到 不压缩直接存储的文件 中 点击确定