我创建了一个简单的Web服务WAS 8.5。 (JAX-RS和Apache CXF) 以下是我的示例配置。
validation-api-1.1.0.Final
<jaxrs:inInterceptors>
<ref bean="validationInInterceptor" />
</jaxrs:inInterceptors>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
<ref bean="exceptionMapper" />
</jaxrs:providers>
<jaxrs:serviceBeans>
<ref bean="olaWebServices" />
</jaxrs:serviceBeans>
<jaxrs:extensionMappings>
<entry key="xml" value="application/xml" />
<entry key="json" value="application/json" />
</jaxrs:extensionMappings>
当我在本地执行时,我可以看到我的wadl。但是当我执行路径时
http://localhost:9080/olaRs/searchBook
它引发错误:
E com.ibm.ws.webcontainer.servlet.ServletWrapper service Uncaught service() exception thrown by servlet cxf: java.lang.NoSuchMethodError: javax/validation/Validator.forExecutables()Ljavax/validation/executable/ExecutableValidator;
at org.apache.cxf.validation.BeanValidationProvider.getExecutableValidator(BeanValidationProvider.java:154)
我的代码示例
public class sampleParam {
@Size(min=3)
private String name;
}