简体   繁体   中英

Deploying application on Tomcat gives an error SEVERE: Unable to process Jar entry for annotations

OS: CentOS 7 3.10.0-693.11.1.el7.x86_64

Jvm: 1.8.0_151-b12

Spring framework version: 1.5.9.RELEASE

Apache: 2.4.6

Tomcat: 7.0.76

Set up: Apache is used as a reverse proxy to serve the java application which runs on tomcat. .war file is created with maven and deployed via the manager application in tomcat. I had some problems before with the actual file size as it was 108MB so I had to increase the upload size and that has been solved, also the application runs locally in STS IDE with tomcat without problems.

Problem description: After the application has been deployed via the manager application in tomcat, I get an error when I try to access the application "404". Then I went over to the log files and I got the following message:

SEVERE: Unable to process Jar entry [com/amazonaws/services/redshift/waiters/ClusterDeleted$IsCreatingMatcher.class] from Jar [jar:file:/usr/share/tomcat/webapps/myApplication-0.0.1-SNAPSHOT/WEB-INF/lib/aws-java-sdk-redshift-1.11.106.jar!/] for annotations

The application does relay on AWS API and the dependency has been specified in the pom.xml file

<dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-java-sdk</artifactId>
 <version>1.11.106</version>
</dependency>

On the side note I have see that other people have encountered similar problems or should I say exactly the same problem with different dependencies.

Link 1: How to solve : Unable to Process Jar entry

Link 2: Deploy a war project on tomcat 7.0.56, get error " Unable to process Jar entry"

Link 3: Unable to process jar entry from Jar

There were no replies in the post of link 2 but there were replies in the link 1 post, where most of the solutions proposed from what I could see were specific to that dependency, and somebody did mention that the update of tomcat to tomcat 8 solved the problem for them. This I would like to avoid as I would much prefer to use the version available in the centos repos. Did not get much more from the third link either other then a suggested update of tomcat. Where it was stated that 7.0.58 version of tomcat should not be used, but then again I am using a newer version.

Thank you all for your time and effort.

Okay so finally I managed to get to the bottom of the problem and find a cause and then a solution.

First thing that I did was go over to a catalina log and check it out, turns out there were a good amount of errors relating to jar files. Then I went over to those jar files that were being referenced in catalina log file and I checked the hashes which did not match the hashes of the original jar files. This usually means one thing, either you have different jar files or the jar files are corrupt. So the root cause of the problem were corrupted jar files and the problem had nothing to do with the version of tomcat and the respective libraries.

Solution:

Rename the current .m2 folder to .m2-corrupt, or to whatever you want, you can also delete it but better safe then sorry.

Move the .war files from the target folder somewhere temporarily

Perform a maven update

Recreate the .war file

Attempt to deploy the new .war file and see how it goes, it went well for me.

Since all went well for me I deleted the old .m2 folder and old .war files

Note: I hope that this saves someone some time and helps then out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM