Hibernate Validator java.lang.NoClassDefFoundError:无法初始化类org.hibernate.validator.internal.engine.ConfigurationImpl [英] Hibernate Validator java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl

查看:1152
本文介绍了Hibernate Validator java.lang.NoClassDefFoundError:无法初始化类org.hibernate.validator.internal.engine.ConfigurationImpl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读并且,但是没有做到"帮忙...

I have read this and this, but that didn't help...

我正在使用具有以下版本/依赖项的休眠验证器:

I am using hibernate validator with the following versions/dependencies:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>5.4.1.FINAL</version>
</dependency>
<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>1.1.0.Final</version>
</dependency>
<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.el</artifactId>
    <version>3.0.1-b08</version>
</dependency>

我以为我做的一切正确,我的日志(用verbose:class作为标志)告诉我:

I thought I'm doing everything correctly, and my logs (with verbose:class as a flag) tell me that:

[从以下位置加载了org.hibernate.validator.internal.engine.ConfigurationImpl 文件:.../hibernate-validator-5.4.1.Final.jar]

[Loaded org.hibernate.validator.internal.engine.ConfigurationImpl from file:.../hibernate-validator-5.4.1.Final.jar]

[从文件中加载了javax.validation.Validation:.../validation-api-1.1.0.Final.jar]

[Loaded javax.validation.Validation from file:.../validation-api-1.1.0.Final.jar]

但是稍后在运行时,当我使用

But later at runtime, when I use

Validator validator = Validation.buildDefaultValidatorFactory().getValidator();

我遇到了经典错误:

java.lang.NoClassDefFoundError:无法初始化类org.hibernate.validator.internal.engine.ConfigurationImpl

java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl

我还尝试降级到hibernate-validator 4.3.1和javax.validation-api 1.0.0,但奇怪的是,该错误仍然足够.

I also tried downgrading to hibernate-validator 4.3.1 and javax.validation-api 1.0.0, but the error weirdly enough remained the same.

我在该项目中还有其他依赖项(例如Spring等),但据我所知,没有一个使用hibernate-validator或javax验证api. (如果是这样,我还会在日志中看到它们,不是吗?)

I have loads of other dependencies in this project(e.g. Spring etc.) , but as far as I can see, none that use hibernate-validator or the javax validation api. (If that were the case, I'd also see them loaded in the logs, wouldn't I?)

有什么帮助吗?

推荐答案

对我来说,问题在于Hibernate Validator依赖于jboss-logging. 而且jboss日志记录不是我的类路径的一部分. 唯一的例外是没有告诉我在尝试实例化休眠配置时,类not def发现错误是因为在类路径中缺少了jboss登录.

For me the problem was that Hibernate Validator depended on jboss-logging. And the jboss logging was not part of my classpath. The exception was not telling me that the class not def found error while trying to instantiate the hibernate configuration impl was from missing jboss logging on the classpath.

将其添加到类路径后,找不到类def的错误就消失了.

Once I added it to the classpath, the class def not found error went away.

这篇关于Hibernate Validator java.lang.NoClassDefFoundError:无法初始化类org.hibernate.validator.internal.engine.ConfigurationImpl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆