Java (warning)FAILED to scan JAR (error)FAILED to process JAR
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19566381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
(warning)FAILED to scan JAR (error)FAILED to process JAR
提问by user2357566
My web application running on tomcat and complied by maven is giving the warnings and errors below. I can see all the JARs in my local repository though can someone please help.
我在 tomcat 上运行并由 maven 编译的 Web 应用程序给出了以下警告和错误。我可以在本地存储库中看到所有 JAR,但有人可以帮忙。
WARNING: Failed to scan JAR [file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/F_Quote-1.0-SNAPSHOT/WEB-INF/lib/spring-webflow-2.4.0.BUILD-20130620.194537-39.jar] from WEB-INF/lib
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
................
WARNING: Failed to scan JAR [file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/F_Quote-1.0-SNAPSHOT/WEB-INF/lib/spring-binding-2.4.0.BUILD-20130620.194537-39.jar] from WEB-INF/lib
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Sour
...........
WARNING: Failed to scan JAR [file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/F_Quote-1.0-SNAPSHOT/WEB-INF/lib/spring-js-resources-2.4.0.BUILD-20130620.194537-39.jar] from WEB-INF/lib
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Sour
.......
WARNING: Failed to scan JAR [file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/F_Quote-1.0-SNAPSHOT/WEB-INF/lib/spring-js-2.4.0.BUILD-20130620.194537-39.jar] from WEB-INF/lib
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Sour
........
SEVERE: Failed to process JAR found at URL [jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/F_Quote-1.0-SNAPSHOT/WEB-INF/lib/spring-js-resources-2.4.0.BUILD-20130620.194537-39.jar!/] for ServletContainerInitializers for context with name [/F_Quote-1.0-SNAPSHOT]
Oct 24, 2013 2:26:33 PM org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
Oct 24, 2013 2:26:33 PM org.apache.catalina.startup.TldConfig tldScanJar
WARNING: Failed to process JAR [jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/F_Quote-1.0-SNAPSHOT/WEB-INF/lib/spring-webflow-2.4.0.BUILD-20130620.194537-39.jar!/] for TLD files
This is my pom.xml file. In my local repository I can see all the JARS that are said to be missing. But in my eclipse when i expand the maven repository there's nothing inside the missing JAR.
这是我的 pom.xml 文件。在我的本地存储库中,我可以看到所有据说丢失的 JARS。但是在我的 Eclipse 中,当我扩展 Maven 存储库时,缺少的 JAR 中什么也没有。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.farchis</groupId>
<artifactId>F_Quote</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Farchis Estimator</name>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
</repository>
<repository>
<id>org.springsource.maven.snapshot</id>
<name>SpringSource Maven Central-compatible Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.6.Final</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- Spring framework -->
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.4.0.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-faces</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
<!-- // -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- JSF -->
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.14</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
-->
<!-- // -->
<!-- Tomcat 6 need this
<dependency>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>1.0</version>
</dependency>
-->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.6.Final</version>
</dependency>
<!--
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
JSR-330
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
-->
</dependencies>
</project>
回答by MidnightJava
I had this problem also, but removing the jar file is not an option. The jar files unable to be processed are the tomcat jar files needed to run the server. However, after reading the comment in the OP, I tried moving the jar files from lib to a temp location, attempting to start tomcat and seeing the expected error message, and then copying the files back to lib. This worked. I have no idea why.
我也有这个问题,但删除 jar 文件不是一个选项。无法处理的jar文件是运行服务器所需的tomcat jar文件。但是,在阅读 OP 中的评论后,我尝试将 jar 文件从 lib 移动到临时位置,尝试启动 tomcat 并查看预期的错误消息,然后将文件复制回 lib。这奏效了。我不知道为什么。
回答by ahao
Perhaps the jar file was damaged because of interruption during download. You may delete the jar and download again then try.
可能是因为下载过程中断,jar 文件已损坏。您可以删除jar并重新下载然后尝试。
I had this problem also, this solution is worked good for me.
我也有这个问题,这个解决方案对我很有用。
回答by Vahap Gencdal
This problem occurs when you use a dependency and this dependency has another dependency. when this parent dependency has scope like compiler.
it say I wont use this dependency in runtime so when you say run project, maven say I cant find child dependency for runtime.
so I think you can control your dependencies and if you delete your dependency version which one giving error, and if you give the right scope I think your problem will solve.
当您使用一个依赖项并且此依赖项具有另一个依赖项时,会出现此问题。当此父依赖项具有类似编译器的作用域时。
它说我不会在运行时使用这个依赖项,所以当你说运行项目时,maven 说我找不到运行时的子依赖项。
所以我认为你可以控制你的依赖项,如果你删除你的依赖项版本哪个出错,如果你给出正确的范围,我认为你的问题会解决。
More information for scope:
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
有关范围的更多信息:https:
//maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
example I solved in my project.
我在我的项目中解决的例子。
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate-jpamodelgen}</version>
</dependency>
Error:
错误:
/Users/vahap/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-api-2.3.1.jar (No such file or directory)
after I deleted version: because hibernate-jpamodelgen using compiler scope. when I add compiler scope problem resolved for me
在我删除版本之后:因为 hibernate-jpamodelgen 使用编译器范围。当我添加为我解决的编译器范围问题时
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>compile</scope>
</dependency>