简体   繁体   中英

Jersey 1.19.4 application with packaged all dependencies in WEB-INF throws FileNotFoundException for jersey-server on Tomcat 8.5

I have packaged these Jersey 1.19 libraries within my WEB-INF folder:

  • jersey-client-1.19.4.jar
  • jersey-core-1.19.4.jar
  • jersey-json-1.19.4.jar
  • jersey-multipart-1.13.jar
  • jersey-server-1.19.4.jar
  • jersey-servlet-1.19.4.jar
  • jsr311-api-1.1.1.jar

and have verified their presence with untar of the packaged war, and deployed it on tomcat 8.5 and it starts fine.

Though, When I run the traffic on this server I get the exception on server.init() :

com.sun.jersey.spi.service.ServiceConfigurationError: com.sun.jersey.spi.container.WebApplicationProvider: : java.io.FileNotFoundException: JAR entry WEB-INF/lib/jersey-server-1.19.4.jar

Additionally, I have a Java application that builds these jersey apps and it did for years. now I am adding support to Jersey 2 apps as well and packaging these war files with required dependencies on tomcat (tomcat 8.5 with jersey1 and jersey2 wars), nothing about jersey in the classpath of the main app.

Check whether all the dependencies are there in pom.xml for Jersey or not.

Update project's pom.xml with these dependencies:

<dependencies>
   <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-client</artifactId>
      <version>1.19.4</version>
   </dependency>
   <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-core</artifactId>
      <version>1.19.4</version>
   </dependency>
   <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-json</artifactId>
      <version>1.19.4</version>
   </dependency>
   <dependency>
      <groupId>com.sun.jersey.contribs</groupId>
      <artifactId>jersey-multipart</artifactId>
      <version>1.19.4</version>
   </dependency>
   <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-server</artifactId>
      <version>1.19.4</version>
   </dependency>
   <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-servlet</artifactId>
      <version>1.19.4</version>
   </dependency>
   <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>jsr311-api</artifactId>
      <version>1.1.1</version>
   </dependency>
</dependencies>

After adding these dependencies, do mvn clean install/package on the project to create a fresh war and then, deploy it on the tomcat.

I think the problem will be solved.

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