gpt4 book ai didi

javax.validation.ValidationException : Unable to find a default provider - 10

转载 作者:行者123 更新时间:2023-12-01 11:35:24 25 4
gpt4 key购买 nike

我在 stackoverflow 上发现了很多类似的问题,但答案对我没有帮助。我在 Rest api 项目中使用 JSR-303 Bean 验证来为现有 bean 类提供验证。我已经添加了所有依赖项,但收到此错误。

javax.validation.ValidationException: Unable to find a default provider
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)[272:wrap_mvn_javax.validation_validation-api_1.0.0.GA:0]
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)[272:wrap_mvn_javax.validation_validation-api_1.0.0.GA:0]
at com.uk.aviva.integration.LookupUkAddress.ValidateAddress.validateRequest(ValidateAddress.java:27)[277:ukAddress:0.0.8.SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_11]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_11]
at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:407)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:278)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:251)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.processor.interceptor.HandleFaultInterceptor.process(HandleFaultInterceptor.java:41)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[144:org.apache.camel.camel-core:2.12.0.redhat-611412]

我看到很多人面临同样的问题,但是给出的解决方案是将 hibernate-validator 版本 4.0 或更高版本添加到类路径中。但我已经在使用 hibernate-validator 版本 5.0.1.FINAL。这是我的 pom 条目

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

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

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

有什么我错过的吗?

最佳答案

所以我找到了一种避免错误的方法并且它有效。为了避免这种情况,请使用 hibernate-validator 依赖项版本 4.2.1.FINAL 和 javax.validation 版本 1.1.0.FINAL。并将这两个添加到您的类路径中。这解决了我的错误。

    <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.FINAL</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>4.2.0.FINAL</version>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>

关于javax.validation.ValidationException : Unable to find a default provider - 10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30052788/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com