![](/img/trans.png)
[英]JAX-WS Validate Schema in WebLogic with @SchemaValidation
[英]Exception when using @SchemaValidation annotation on JAX-WS endpoint in Weblogic
我正在嘗試使模式驗證適用於Weblogic 10.3.3上部署的JAX-WS Web服務。
根據文檔,這應該像向端點類添加注釋“ @SchemaValidation”一樣簡單。 但是,當我嘗試這樣做時,在部署應用程序時會引發以下異常:
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)
錯誤消息抱怨“ com.sun.xml.internal.ws.developer.SchemaValidationFeature”沒有使用@FeatureConstructor注釋的構造函數。 當我看那堂課時,它肯定有一個:
@com.sun.xml.internal.ws.api.FeatureConstructor(value={"handler"})
public SchemaValidationFeature(java.lang.Class arg0);
我已經四處搜尋,但除了這個不幸的靈魂之人沒有得到任何答案之外,找不到更多的參考。 如果有人可以將我指向正確的方向,那將非常好,因為此時此刻我被困住了。
SchemaValidation
批注正在工作,但請確保您導入的是正確的類。
com.sun.xml.ws.developer.SchemaValidation
代替
com.sun.xml.internal.ws.developer.SchemaValidation
默認情況下,第二類與JDK捆綁在一起。 第一個(由weblogic使用)來自glassfish.jaxws.rt_XXX.jar
,因此您可能需要將此jar明確添加到類路徑中。
我最近也遇到過同樣的問題。
為了克服這個問題,我添加了標簽
<validation-request>true</validation-request>
到文件weblogic-webservices.xml
這在應用程序服務器上啟用了SOAP請求驗證。
weblogic-webservices.xml的XML結構
注意:我無法成功使用@SchemaValidation標記,但是上述方式-可以正常使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.