获取错误引起:java.lang.NoClassDefFoundError:javax / validation / ValidatorFactory

时间:2013-06-11 11:59:36

标签: spring hibernate-validator

我有一个春季项目。当我运行时,我得到以下错误

SEVERE: Unable to process Jar entry [javax/validation/bootstrap/GenericBootstrap.class] 
from Jar [jar:file:/D:/Personal%20Work/eclipse%2032%20Bit/workspace/Java%20EE/Spring
/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
/ch17_ImplementTheViewsForContactInformation/WEB-INF/lib/validation-api-1.0.0.GA.jar!/] 
for annotations
java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
    ....

这是我的POM片段

<dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.0.Beta2</version>
    </dependency>

    <!-- Hibernate’s implementation of JSR-303. -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.2.0.Final</version>
    </dependency>

    <!-- The JSR-303 Bean Validation API library. -->
    <dependency>
       <groupId>javax.validation</groupId>
       <artifactId>validation-api</artifactId>
       <version>1.0.0.GA</version> 
    </dependency>

为什么我收到此错误?我查了一下,我在位置C:\Users\basit.ahmed\.m2\repository\javax\validation\validation-api\1.0.0.GA有这个罐子。

我该如何解决这个问题?

由于

1 个答案:

答案 0 :(得分:2)

这可能是因为下载不好造成的。从本地仓库中删除jar,然后重试。