Tag Archives: invalid LOC header (bad signature)

Maven packaging failed invalid LOC header (bad signature)

Maven failed to build the package and reported the following error:

Error creating shaded jar: invalid LOC header (bad signature) -> [ Help 1]

At the beginning, the replacement of the higher version of Maven plugin failed again. However, the error report is more detailed, indicating the problematic jar package: /MNT/D/develop/mavenrepo/COM/Alibaba/fastjson/1.2.44/fastjson-1.2.44. Jar

[INFO] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 32.235 s  
[INFO] Finished at: 2019-11-28T20:46:18+08:00  
[INFO] Final Memory: 56M/720M  
[INFO] ------------------------------------------------------------------------  
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.1:shade (default) on project flink-base: Error creating shaded jar: Problem shading JAR /mnt/d/Develop/mavenRepo/com/alibaba/fastjson/1.2.44/fastjson-1.2.44.jar entry META-INF/services/org.glassfish.jersey.internal.spi.AutoDiscoverable: java.util.zip.ZipException: invalid LOC header (bad signature) -> [Help 1]
[ERROR]   
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.  
[ERROR] Re-run Maven using the -X switch to enable full debug logging.    
[ERROR]   
[ERROR] For more information about the errors and possible solutions, please read the following articles:  
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException  

You can also run MVN – e package and MVN – x package on the command line under the project directory folder according to the prompt, and I see that specific error messages will be printed on the Internet to point out the problematic jar packages. However, it takes too much time to download all jar packages again, so I didn’t try.

Then enter the directory,/MNT/D/develop/mavenrepo/COM/Alibaba/fastjson/1.2.44 /, and find that there is a aether-fb0089ce-dff1-4256-9ccc-a2bb768c48f7-fastjson-1.2.44.jar.sha1-in-progress file in it. Delete all files in the directory and repackage. Success!

Summary: this problem is also the cause of Maven’s error in downloading jar. Most of the problems encountered are the cause of Maven’s error in downloading jar package.

[How to Solve Maven Error] invalid LOC header (bad signature)

Error log:

Warning: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/maven_pro]]
	at java.util.concurrent.FutureTask.report(Unknown Source)
	at java.util.concurrent.FutureTask.get(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/maven_pro]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
	... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@65ffa54a]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
	at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4868)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5003)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@eb36d16]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:724)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 9 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
	at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:142)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	... 12 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
	at java.util.zip.ZipFile.read(Native Method)
	at java.util.zip.ZipFile.access$1400(Unknown Source)
	at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
	at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
	at java.util.zip.InflaterInputStream.read(Unknown Source)
	at sun.misc.IOUtils.readFully(Unknown Source)
	at java.util.jar.JarFile.getBytes(Unknown Source)
	at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
	at java.util.jar.JarFile.getManifest(Unknown Source)
	at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:140)
	... 13 more

Use the maven test command to detect.

The following error was found

[WARNING] Error reading d:\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.jar; invalid LOC header (bad signature)

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building maven_pro Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.powersi:powerbase:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for com.powersi:powermarker:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for oracle.jdbc:OracleDriver:jar:12.1.0.2 is missing, no dependency information available
[WARNING] The POM for org.apache.dubbo:dubbo-all:jar:2.7.0 is missing, no dependency information available
[WARNING] The POM for commons-beanutils:commons-beanutils:jar:1.8.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.yinhai:bcp-dubbocs:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:commonbiz:jar:1.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:sicp3_enc:jar:1.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:PowerFile_fat:jar:1.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:pd_analysis:jar:1.0 is missing, no dependency information available
[WARNING] The POM for commons-net:commons-net:jar:2.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.struts:struts:jar:1.0 is missing, no dependency information available
[WARNING] The POM for org.aspectj.weaver:aspectjweaver:jar:1.9.1 is missing, no dependency information available
[WARNING] The POM for com.aspose.words:asposewords:jar:jdk16:14.11.0.0 is missing, no dependency information available
[WARNING] The artifact javax.xml:jaxb-api:pom:2.1 has been relocated to javax.xml.bind:jaxb-api:pom:2.1
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven_pro ---
[INFO] Using 'GBK' encoding to copy filtered resources.
[INFO] Copying 49 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven_pro ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 489 source files to E:\powersi\code\maven_pro\target\classes
[WARNING] Read d:\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.Error on jar; invalid LOC header (bad signature)
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/common/action/DataImportAction.java: Some input files use or override outdated APIs.
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/common/action/DataImportAction.java: For more information, please use -Xlint: deprecation to recompile.
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/problem/action/ProManagerAction.java: Some input files use unchecked or unsafe actions.
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/problem/action/ProManagerAction.java: For more information, please use -Xlint: unchecked to recompile.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven_pro ---
[INFO] Using 'GBK' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven_pro ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven_pro ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.721 s
[INFO] Finished at: 2019-09-11T15:45:19+08:00
[INFO] Final Memory: 42M/581M
[INFO] ------------------------------------------------------------------------

Delete the woodstox core folder in the local Maven warehouse and install Maven clean again