JAX-WS Validate Schema in WebLogic with @SchemaValidation

后端 未结 2 644
花落未央
花落未央 2021-01-16 03:06

I wasn\'t able to find the solution and I found more people stuck in the same problem so I will post it here.


By default a JAX-WS server (at least for WebLogic

相关标签:
2条回答
  • 2021-01-16 03:35

    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.

    0 讨论(0)
  • 2021-01-16 03:40

    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.

    0 讨论(0)
提交回复
热议问题