JAX-WS Validate Schema in WebLogic with @SchemaValidation

与世无争的帅哥 提交于 2019-12-01 12:41:26

The problem was: I was using the wrong package for @SchemaValidation.

The correct class that worked for me is com.sun.xml.ws.developer.SchemaValidation, which is provided in the file mw_home\modules\glassfish.jaxws.rt_1.3.0.0_2-1-5.jar (using WLS 10.3.6).

In the previous code segment I was referencing the wrong package: com.sun.xml.internal... but using the one provided by WebLogic worked instantly.

If you are using Maven and using the bundled JAR as dependency you might not have this library in the classpath, which led me to the problem. You need to add it to your classpath via dependency (provided scope only) and reference the correct package for that class name in your JAX-WS WebService class (an abstract class won't do it).

More information in the Enabling Schema Validation on the Server page.

This schema validation is enough for me at the moment since I do not need any custom behavior.

In my case: Maven project with many modules. I got the next error when was trying to deploy application into tomcat:

failed to parse runtime descriptor: javax.xml.ws.WebServiceException: Annotation @com.sun.xml.ws.developer.SchemaValidation(handler=class com.sun.xml.ws.server.DraconianValidationErrorHandler) is not recognizable, at least one constructor of class com.sun.xml.ws.developer.SchemaValidationFeature should be marked with @FeatureConstructor

I resolved problem by don't including jaxws-rt.jar in WEB-INF/lib. It appears that this library already exists in the tomcat/lib folder.

Just tuned up pom.xml, setted provided scope for this dependency entry. Now all works fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!