org.hibernate.validator.engine.ConfigurationImpl 的来源

发布于 2024-11-09 17:19:52 字数 1068 浏览 5 评论 0原文

好的,我正在尝试让验证器使用 jsp 表单。刚刚开始使用 maven,所以这一切都有点新...找到我应该为上述类选择哪个存储库的最佳方法是什么?我已经有以下条目进行验证:

    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>


    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator-annotation-processor</artifactId>
        <version>4.1.0.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.1.0.Final</version>
    </dependency>   

我尝试加载 hibernate 本身,但这破坏了构建:我使用 eclipse 进行持久化,并且在拖入大量先决条件库后构建失败。

我认为我应该得到一个更好的策略,而不是仅仅用存储库来刺杀..

只是要清楚:我收到错误:

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

这应该处于 hibernate-validator 依赖关系中,因此行为不符合我的预期。

OK, I'm trying to get a validator working with a jsp form.. Have just started using maven, so it's all a bit new... what's the best way of locating which repository I should be selecting for the above class? I already have the following entries for validation:

    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>


    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator-annotation-processor</artifactId>
        <version>4.1.0.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.1.0.Final</version>
    </dependency>   

I tried loading hibernate itself, but that broke the build: I'm using eclipse for persistence, and building fails after dragging in a huge number of prerequisite libraries.

I figured that I should get a better strategy than just stabbing away with repositories..

Just to be clear: I'm getting the error:

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

This should be in the hibernate-validator dependency, so not behaving as I would expect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爺獨霸怡葒院 2024-11-16 17:19:52

您的类路径上是否有 slf4j-api(这应该由 HV 拉入,但只是为了确保)?

NoClassDefFoundError 并不意味着 ConfigurationImpl 不可用,但它无法加载(通常是由于静态初始化程序中的问题或导入不可用的加载类)。

关于使用注释处理器的旁注:除了将其添加为项目依赖项之外,您还可以通过 Maven 注释处理器插件使用它。这样您就不会意外地从项目中导入类。 Hibernate 验证器参考指南。

Do you have slf4j-api on the classpath (this should be pulled in by HV, but just to make sure)?

The NoClassDefFoundError doesn't mean that ConfigurationImpl is not available, but it couldn't be loaded (typically due to problems in the static initializer or by imports of the loaded class which are not available).

A side note on using the annotation processor: instead of adding it as project dependency you can also use it via the Maven annotation processor plugin. That way you can't accidentally import classes from it in your project. The set-up is described in detail in the Hibernate Validator reference guide.

酒几许 2024-11-16 17:19:52

OP 可能不再需要它,但也许其他人会。

我在使用 Hibernate Validator 4.3 Final 和 slf4j 1.5.11 的组合时遇到了类似的问题
最后我找到了两个愿意一起工作的版本,即:
-Hibernate 验证器最终版 4.2
-slf4j 1.6.6

OP probably won't need it anymore, but maybe somebody else will.

I've had a similar problem with combination of Hibernate Validator 4.3 Final and slf4j 1.5.11
Finally I've found pair of versions that are willing to work together namely:
-Hibernate Validator Final 4.2
-slf4j 1.6.6

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文