执行maven打包的springboot jar时报错 Caused by: java.util.zip.ZipException: invalid distance too far back

C:\dev\vue\alcarl\xxl-job\xxl-job-admin\target>java -jar xxl-job-admin-2.2.0-SNAPSHOT.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitiali
zer : org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer
        at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:445)
        at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:427)
        at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:420)
        at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:272)
        at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:253)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
        at com.xxl.job.admin.XxlJobAdminApplication.main(XxlJobAdminApplication.java:13)
        ... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:282)
        at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:438)
        ... 15 more
Caused by: java.util.zip.ZipException: invalid distance too far back
        at java.util.zip.InflaterInputStream.read(Unknown Source)
        at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipInflaterInputStream.java:52)
        at java.io.FilterInputStream.read(Unknown Source)
        at sun.misc.Resource.getBytes(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        ... 26 more

检查 maven install 时 输出的日志,应该会用 WARNING警告说 bad signature

[WARNING] 读取C:\Users\wangxin\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.2.3.RELEASE\spring-boot-autoconfigure-2.2.3.RELEASE.jar时出错; invalid LOC header (bad signature)
[WARNING] 读取C:\Users\wangxin\.m2\repository\io\netty\netty-all\4.1.45.Final\netty-all-4.1.45.Final.jar时出错; invalid LOC header (bad signature)

结果原因都是本地.m2目录的maven库包下载不完整导致的,删掉不完整的重新下就好了

© 2020, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com

0.00 avg. rating (0% score) - 0 votes
点赞