The jar file may be corrupt. Try removing the content of the following folder:
C:\Users\[username]\.m2\repository
Then right click your project, select Maven, Update Project, check on Force Update of Snapshots/Releases.
The mainly problem are corrupted jars.
To find the corrupted one, you need to add a Java Exception Breakpoint in the Breakpoints View of Eclipse, or your preferred IDE, select the java.util.zip.ZipException
class, and restart Tomcat instance.
When the JVM suspends at ZipException
breakpoint you must go to
JarFile.getManifestFromReference()
in the stack trace, and check attribute name
to see the filename.
After that, you should delete the file from file system and then right click your project, select Maven, Update Project, check on Force Update of Snapshots/Releases.
You need to check which jar is giving problem. It must be corrupted. Delete that jar and run mvn spring-boot:run
command again. May be more that one jar has corrupted so every time you need to run that command to delete that jar. In my case mysql, jackson, aspect jars was corrupted mvn spring-boot:run
command 3 times and I figure out this and deleted the jars from .m2
folder. Now the issue has resolved.
From gsitgithub/find-currupt-jars.txt, the following command lists all the corrupted jar files in the repository:
find /home/me/.m2/repository/ -name "*jar" | xargs -L 1 zip -T | grep error | grep invalid
You can delete the corrupted jar files, and recompile the project.
Example output:
warning [/cygdrive/J/repo/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar]: 98304 extra bytes at beginning or within zipfile
(attempting to process anyway)
file #1: bad zipfile offset (local header sig): 98304
(attempting to re-compensate)
zip error: Zip file invalid, could not spawn unzip, or wrong unzip (original files unmodified)
I'd like to give my practice.
Use your preferred IDE, take eclipse for for example here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With