Error: invalid signature file digest for manifest main attributes
The project runs normally on the local machine, but it cannot be started when deployed to the Tomcat of the server. The following error is reported:
Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:239) [:1.6.0_30]
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:193) [:1.6.0_30]
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:296) [:1.6.0_30]
at java.util.jar.JarVerifier.update(JarVerifier.java:207) [:1.6.0_30]
at java.util.jar.JarFile.initializeVerifier(JarFile.java:342) [:1.6.0_30]
at java.util.jar.JarFile.getInputStream(JarFile.java:410) [:1.6.0_30]
at org.jboss.vfs.spi.JavaZipFileSystem.getFile(JavaZipFileSystem.java:159) [jboss-vfs.jar:3.0.0.GA]
at org.jboss.vfs.VirtualFile.getPhysicalFile(VirtualFile.java:262) [jboss-vfs.jar:3.0.0.GA]
at org.jboss.web.deployers.AbstractWarDeployer$1.visit(AbstractWarDeployer.java:853) [:6.0.0.Final]
at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:408) [jboss-vfs.jar:3.0.0.GA]
at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]
at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]
at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]
at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:396) [jboss-vfs.jar:3.0.0.GA]
at org.jboss.web.deployers.AbstractWarDeployer.getExplodedWarUrl(AbstractWarDeployer.java:866) [:6.0.0.Final]
at org.jboss.web.deployers.AbstractWarDeployer.deploy(AbstractWarDeployer.java:400) [:6.0.0.Final]
... 47 more
Almost all the Internet queries have problems. There are files in the meta-inf folder of the packaged jar or war.JBoss is trying to process these files or doesn’t want to process them there.
However, I found that my meta-inf folder was empty and there was no * RSA,*.DSA,*.SF and other documents are hard to understand
I have also tried to repackage and replace the Tomcat version, but this problem has not been solved.
Finally, I thought that the project is divided into modules. Are there these files in the jar package generated by the referenced submodule? Finally, I checked one by one and finally found the problem:
there are these * RSA,*. DSA,*. SF files
remove these files from the jar package:
zip -d <jar file name>.jar META-INF/*.RSA META-INF/*.DSA META-INF/*.SF
But this is a temporary solution but not a permanent solution. The problem will still occur in the next packaging. Finally, go to the pom.xml file to exclude META-INF/*.SF and other files
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<!-- Exclude the following files to prevent verification errors when the program is started -->
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
Read More:
- [Solved] Jar error on Linux: no main manifest attribute
- [Solved] Mvel2 Error: java.lang.VerifyError method: getKnownEgressType signature
- [Solved] qrcode-error: Exception in thread “main” java.lang.NoClassDefFoundError…
- Java uses class array to report error Exception in thread “main” java.lang.NullPointerException solution
- [Solved] jar Run Error: no main manifest attribute
- Resolve warning: could’t clear Tomcat cache java.lang.NoSuchFieldException: resourceEntries
- [Solved] nacos Startup Error: nested exception is java.lang.RuntimeException: java.lang.RuntimeException: [db-load-error
- [Solved] JAVA OpenCV Startup Error: java.lang.UnsatisfiedLinkError
- [Solved] Exception in thread “main“ java.lang.NoSuchFieldError: level
- [Solved] IDEA springboot Startup Error: java.lang.UnsatisfiedLinkError: no tcnative-1 in java.library.path
- [Solved] IDEA startup Error: Java lang.StackOverflowError
- [Solved] Swagger Startup Error: java.lang.NumberFormatException: For input string: ““
- [Solved] Tomcat Server Error: java.lang.NullPointerException Csonsole Error ClassNotFoundException: com.mysql.jdbc.Driver
- [Solved] Tomcat startup error: sub-container startup failed
- Java error: unable to find or load main class (package name in source file)
- Gitee Idea Push Error: Invocation failed Server returned invalid Response. java.lang.RuntimeException
- Elasticsearch Startup Error: unable to install syscall filter: java.lang.UnsupportedOperationException: seccomp
- [Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)
- [Solved] Docker Elasticsearch8.4.0 Error: Exception in thread “main” java.nio.file.FileSystemException
- [Solved] Java.lang.ClassCastException: [Ljava.lang.Long; cannot be cast to java.util.List