简体   繁体   English

在Weblogic的JAX-WS端点上使用@SchemaValidation批注时发生异常

[英]Exception when using @SchemaValidation annotation on JAX-WS endpoint in Weblogic

I am trying to get schema validation working for a JAX-WS Web Service deployed on Weblogic 10.3.3. 我正在尝试使模式验证适用于Weblogic 10.3.3上部署的JAX-WS Web服务。

According to the documentation, this should be as simple as adding the annotation "@SchemaValidation" to the endpoint class. 根据文档,这应该像向端点类添加注释“ @SchemaValidation”一样简单。 However when I try this the following exception is thrown when the application is deployed: 但是,当我尝试这样做时,在部署应用程序时会引发以下异常:

Caused by: javax.xml.ws.WebServiceException: 
Annotation@com.sun.xml.internal.ws.developer.SchemaValidation 
(handler=class com.sun.xml.internal.ws.server.DraconianValidationErrorHandler)
is not recognizable, 
atleast one constructor of class com.sun.xml.internal.ws.developer.SchemaValidationFeature 
should be marked with @FeatureConstructor
at com.sun.xml.ws.binding.WebServiceFeatureList.getWebServiceFeatureBean(WebServiceFeatureList.java:169)
at com.sun.xml.ws.binding.WebServiceFeatureList.parseAnnotations(WebServiceFeatureList.java:141)

The error message is complaining that "com.sun.xml.internal.ws.developer.SchemaValidationFeature" does not have a constructor annotated with @FeatureConstructor. 错误消息抱怨“ com.sun.xml.internal.ws.developer.SchemaValidationFeature”没有使用@FeatureConstructor注释的构造函数。 When I look at that class, it sure seems to have one: 当我看那堂课时,它肯定有一个:

  @com.sun.xml.internal.ws.api.FeatureConstructor(value={"handler"})
  public SchemaValidationFeature(java.lang.Class arg0);

I have googled around but cannot find any reference to this more than this fellow unfortunate soul who did not get any answers. 我已经四处搜寻,但除了这个不幸的灵魂之人没有得到任何答案之外,找不到更多的参考。 It would be great if someone could point me in the right direction because at this moment I am stuck. 如果有人可以将我指向正确的方向,那将非常好,因为此时此刻我被困住了。

SchemaValidation annotation is working, but make sure you're importing correct class. SchemaValidation批注正在工作,但请确保您导入的是正确的类。

com.sun.xml.ws.developer.SchemaValidation

instead of 代替

com.sun.xml.internal.ws.developer.SchemaValidation

The second class is bundled with JDK by default. 默认情况下,第二类与JDK捆绑在一起。 The first one (used by weblogic) comes from glassfish.jaxws.rt_XXX.jar , so you may need to add this jar to your classpath explicitly. 第一个(由weblogic使用)来自glassfish.jaxws.rt_XXX.jar ,因此您可能需要将此jar明确添加到类路径中。

I have faced the same problem recently. 我最近也遇到过同样的问题。

To overcome this, I added the tag 为了克服这个问题,我添加了标签

<validation-request>true</validation-request>

to the file weblogic-webservices.xml 到文件weblogic-webservices.xml

This enabled SOAP request validation on the app-server. 这在应用程序服务器上启用了SOAP请求验证。

XML Structure of weblogic-webservices.xml weblogic-webservices.xml的XML结构

Note : I have not been able to use the @SchemaValidation tag successfully, but the above way - works as expected. 注意:我无法成功使用@SchemaValidation标记,但是上述方式-可以正常使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM