我使用Tomcat 8和Jersey的动态Web项目依赖项。
<dependencies>
<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-client -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.17.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-server -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.17.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-core -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.17.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-servlet -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.17.1</version>
</dependency>
</dependencies>
运行时我收到错误:
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:113)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
... 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:111)
... 13 more
我无法找出我做错了什么。这种Jersey的依赖关系和Tomcat版本的兼容性有问题吗? 如果您需要,我可以添加一些有关项目的信息。
答案 0 :(得分:0)
这是我的maven的依赖: enter image description here
他们是所有的罐子)
答案 1 :(得分:0)
我无法重现您的错误;我使用了你的依赖项,我的泽西应用程序运行正常。 它绝对是一个腐败的jar,正如其他多个问题所示:tomcat server fails to start the server and application in STS,Server does not starts with spring app,Tomcat Server failing to start。当下载罐子时,互联网连接出现问题时,有时会发生这种情况。
删除maven存储库文件夹中的所有jar文件,默认位于Users/{yourusername}/.m2/repository
。
右键单击您的项目,选择Maven - &gt;更新项目 - &gt;检查快照/版本的强制更新 - &gt;确定。
从Maven存储库再次下载所有jar文件。它应该工作正常。