gpt4 book ai didi

java - Servicemix 找不到 javax.validation 包

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

我正在使用 servicemix-4.4.1,

在我的 pom.xml 中,我定义了一个依赖项:

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.1.Final</version>
<scope>provided</scope>
</dependency>

如您所见,我已将范围设置为 provided,因为 servicemix(osgi 容器)将为我们提供 jar。

在我添加的 features.xml 文件中:

<feature name="myapp-libs" version="${version}">
....
<bundle>mvn:org.hibernate/hibernate-validator/4.3.1.Final/jar</bundle>

现在,当我尝试将 myapp-libs 加载到 servicemix 中时,我得到以下信息:

karaf@root> features:install myapp-libs
Error executing command: Could not start bundle mvn:org.hibernate/hibernate-validator/4.3.1.Final/jar in feature(s)
myapp-libs-1.24-SNAPSHOT: Unresolved constraint in bundle org.hibernate.validator [973]:
Unable to resolve 973.0: missing requirement [973.0] package; (&(package=javax.validation)(version>=1.0.0)(!(version>=2.0.0)))

最佳答案

我在我的 features.xml 中定义了 javax.validation:

<bundle>mvn:javax.validation/validation-api/1.1.0.Final/jar</bundle> 

但是它再也找不到 hibernate-validator jar 了:

Add a provider like Hibernate Validator (RI) to your classpath.
javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:110)

这很奇怪,因为在日志中我可以看到正在加载 hibernate-validator。

22:53:40,835 | INFO  | l Console Thread | FeaturesServiceImpl              | ?                               

? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:com.googlecode.guava-osgi/guava-osgi/9.0.0/jar
22:53:42,064 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:commons-lang/commons-lang/2.6
22:53:42,203 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:junit/junit/4.11/jar
22:53:42,312 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:org.apache.thrift/libthrift/0.7.0/jar
22:53:42,441 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:org.apache.cassandra/cassandra-thrift/1.1.0/jar
22:53:42,625 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:org.hectorclient/hector-core/1.1-2/jar
22:53:42,836 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:org.codehaus.jackson/jackson-core-asl/1.9.6/jar
22:53:43,396 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.6/jar
22:53:44,396 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:org.codehaus.jackson/jackson-jaxrs/1.9.6/jar
22:53:44,416 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:org.hibernate/hibernate-validator/4.1.0.Final/jar
22:53:44,425 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:javax.validation/validation-api/1.1.0.Final/jar
22:53:44,459 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:org.apache.camel/camel-jackson/2.8.0/jar
22:53:44,467 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle mvn:joda-time/joda-time/1.6
22:53:44,780 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:org.perf4j/perf4j/0.9.16/jar
22:53:45,061 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:org.aspectj/aspectjrt/1.6.1/jar
22:53:46,600 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:org.aspectj/aspectjweaver/1.6.1/jar
22:53:46,867 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:commons-jexl/commons-jexl/1.1/jar
22:53:46,893 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Installing bundle wrap:mvn:com.eaio.uuid/uuid/3.2/jar
22:53:46,899 | INFO | l Console Thread | FeaturesServiceImpl | ? ? | 30 - org.apache.karaf.features.core - 2.2.2.fuse-07-11 | Bundles to refresh:

关于java - Servicemix 找不到 javax.validation 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20684988/

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