Unable to open nested entry ‘********.jar‘ 问题解决

今天把现网版本的task的jar拖回来然后用7-zip打开拖了一个jar进去替换mysql-connector-java-5.1.47.jar 为 mysql-connector-java-5.1.27.jar

启动微服务的时候就报错下面的

java 复制代码
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的时候,把要添加的文件复制到不压缩直接存储的文件中点击确定

相关推荐
战血石LoveYY11 小时前
Integer类型超限,导致数据异常
java·算法
m0_6174939411 小时前
Python OpenCV 透视变换(Perspective Transform)详解与实战
开发语言·python·opencv
小李不困还能学11 小时前
PyCharm下载安装与配置教程
ide·python·pycharm
博观而约取厚积而薄发12 小时前
Pytest 从入门到精通,一篇就够(超详细实战教程)
python·测试工具·单元测试·自动化·pytest
imzed12 小时前
使用 Playwright + Pytest 构建 Web UI 自动化测试框架
python·自动化·pytest
普通网友12 小时前
pytest一些常见的插件
开发语言·python·pytest
时空系12 小时前
Python 高性能高压缩打包器 —— 基于 JianPy 语义分析引擎
python
cndes12 小时前
给Miniconda换源,让包下载更迅速
开发语言·python
乐观的Terry12 小时前
1、为什么要自己造发布系统
java·spring boot·后端·spring cloud·架构