[英]Using Camel Bean validator Component
I am getting an exception while using Camel Bean Validator. 使用骆驼豆验证器时出现异常。 The exception is
No component found with scheme: bean-validator
And i have these dependencies in my POM 唯一的例外是
No component found with scheme: bean-validator
而且我的POM中有这些依赖项
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
<version>2.13.2</version>
<scope>provided</scope>
</dependency>
And i am using Bean Validator component as below 我正在使用如下所示的Bean Validator组件
from("direct:XXX").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Car car = new Car();
//car.setVehicleId(1);
car.setName("Swift");
car.setCompany("Maruti");
exchange.getIn().setBody(car);
}
}).to("bean-validator://x").process(new Processor() {
@Override
public void process(Exchange arg0) throws Exception {
LOG.debug("Bean Validation is Success");
}
});
But when i am deploying the generated war into the Wildfly, am getting the exception No component found with scheme: bean-validator
. 但是,当我将产生的战争部署到Wildfly中时,却出现了异常
No component found with scheme: bean-validator
。 To my surprise the code is working fine in standalone application. 令我惊讶的是,该代码在独立应用程序中运行良好。 Your help is greatly appreciated.
非常感谢您的帮助。
The issue is that you define the scope as provided, which means the JAR is supposely already part of the server. 问题是您定义了所提供的范围,这意味着JAR可能已经是服务器的一部分。 You most often only use provided scope for API JARs such as the servlet api, etc.
您通常只使用API JAR提供的范围,例如servlet api等。
So change this 所以改变这个
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
<version>2.13.2</version>
<scope>provided</scope>
</dependency>
To 至
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
<version>2.13.2</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.