Failed to get nested archive for entry BOOT

环境:

springboot + kafka + ES 。。。。。。

maven3.6

jdk8

问题是 jar包启动失败报错,错误如下:

1Exception in thread "main" java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/spring-kafka-2.2.7.RELEASE.jar 2 at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:108) 3 at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:86) 4 at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:70) 5 at org.springframework.boot.loader.Launcher.launch(Launcher.java:49) 6 at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) 7Caused by: java.io.IOException: Unable to open nested jar file 'BOOT-INF/lib/spring-kafka-2.2.7.RELEASE.jar' 8 at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:256) 9 at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:241) 10 at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:103) 11 ... 4 more 12Caused by: java.lang.IllegalStateException: Unable to open nested entry 'BOOT-INF/lib/spring-kafka-2.2.7.RELEASE.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 13 at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:284) 14 at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:264) 15 at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:252) 16 ... 6 more

pom.xml文件如下

1<!-- spring-boot-starter-data-elasticsearch --> 2 <dependency> 3 <groupId>org.springframework.boot</groupId> 4 <artifactId>spring-boot-starter-data-elasticsearch</artifactId> 5 </dependency> 6 <!-- elasticsearch-rest-high-level-client --> 7 <dependency> 8 <groupId>org.elasticsearch.client</groupId> 9 <artifactId>elasticsearch-rest-high-level-client</artifactId> 10 </dependency> 11 12 <!--swagger2--> 13 <dependency> 14 <groupId>io.springfox</groupId> 15 <artifactId>springfox-swagger2</artifactId> 16 <version>2.6.1</version> 17 </dependency> 18 19 <dependency> 20 <groupId>io.springfox</groupId> 21 <artifactId>springfox-swagger-ui</artifactId> 22 <version>2.6.1</version> 23 </dependency> 24 25 <!-- devtools --> 26 <dependency> 27 <groupId>org.springframework.boot</groupId> 28 <artifactId>spring-boot-devtools</artifactId> 29 <scope>runtime</scope> 30 <optional>true</optional> 31 </dependency> 32 <!--sofaboot测试插件--> 33 <dependency> 34 <groupId>com.alipay.sofa</groupId> 35 <artifactId>test-sofa-boot-starter</artifactId> 36 </dependency> 37 <dependency> 38 <groupId>org.springframework.boot</groupId> 39 <artifactId>spring-boot-starter-test</artifactId> 40 <scope>test</scope> 41 <exclusions> 42 <exclusion> 43 <groupId>org.junit.vintage</groupId> 44 <artifactId>junit-vintage-engine</artifactId> 45 </exclusion> 46 </exclusions> 47 </dependency> 48 <!-- mybatis --> 49 <dependency> 50 <groupId>org.mybatis.spring.boot</groupId> 51 <artifactId>mybatis-spring-boot-starter</artifactId> 52 <version>1.3.2</version> 53 </dependency> 54 </dependencies> 55 <build> 56 <plugins> 57 <plugin> 58 <groupId>org.springframework.boot</groupId> 59 <artifactId>spring-boot-maven-plugin</artifactId> 60 </plugin> 61 <plugin> 62 <groupId>org.apache.maven.plugins</groupId> 63 <artifactId>maven-shade-plugin</artifactId> 64 <version>3.1.0</version> 65 <executions> 66 <execution> 67 <phase>package</phase> 68 <goals><goal>shade</goal></goals> 69 <configuration> 70 <relocations> 71 <relocation> 72 <pattern>org.apache.http</pattern> 73 <shadedPattern>hidden.org.apache.http</shadedPattern> 74 </relocation> 75 <relocation> 76 <pattern>org.apache.logging</pattern> 77 <shadedPattern>hidden.org.apache.logging</shadedPattern> 78 </relocation> 79 <relocation> 80 <pattern>org.apache.commons.codec</pattern> 81 <shadedPattern>hidden.org.apache.commons.codec</shadedPattern> 82 </relocation> 83 <relocation> 84 <pattern>org.apache.commons.logging</pattern> 85 <shadedPattern>hidden.org.apache.commons.logging</shadedPattern> 86 </relocation> 87 </relocations> 88 </configuration> 89 </execution> 90 </executions> 91 </plugin> 92 </plugins> 93 </build> 94 <repositories>

错误原因分析:

Pom中采用了maven-shade-plugin,最终生成了fat包,超过Spring Boot Loader的上限。因此,在B模块的Pom中直接移除了maven-shade-plugin插件,使得该依赖大小符合要求。

解决办法:

注释掉红圈的plugin。

点赞
收藏

评论区

加载中...

相关推荐

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

tidb集群某个节点报错之:node_exporter

今天启动集群tidb时出现一个错误,是某个tikv节点报错:node\_exporter9100.service failed一个节点的问题会导致整个集群启动失败。去此节点下的日志文件中查找,发现没有什么报错原因。无奈此时只能去系统日志中查看发生了什么问题果然发现了问题Jan1615:35:05ip1723126133

RAC环境单实例启动数据库收到ORA

     在RAC环境中,如果你在没有启动节点的集群服务的情况下单实例启动数据库,将收到类似如下的报错:\oracle@rhel1u01\$sqlSQL\Plus:Release10.2.0.5.0ProductiononTueApr215:00:272013Copyright(

java连接zookeeper服务器出现“KeeperErrorCode = ConnectionLoss for ...”

错误信息如下:1Exceptioninthread"main"org.apache.zookeeper.KeeperException$ConnectionLossException:KeeperErrorCodeConnectionLossfor/test2atorg.apache.zookeeper

第一天:今天学spring的时候遇到一个错误

具体错误如下:Exceptioninthread"main"org.springframework.beans.factory.NoSuchBeanDefinitionException:Nobeannamed'testDao'isdefinedatorg.springframework.beans.factory.support.D