2017-01-30 297 views
0

org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfiedorg.apache.cxf.ws.policy.PolicyException:cause:cxf bundle

由於cxf軟件包的原因,此異常正在進行中。我不知道如何擺脫這一點。任何人有關於這個問題的想法?

服務客戶端用作java程序,但在WSO2應用程序服務器中作爲服務部署時,會引發此異常。 CXF捆綁中的原因,但不知道如何避免它。

異常跟蹤:

WARN {org.apache.cxf.phase.PhaseInterceptorChain} - Application {http://test.tss.com/}Sync#{http://test.tss.com/}hello has thrown exception, unwinding now 
org.apache.cxf.interceptor.Fault: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied. 
    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) 
    at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213) 
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128) 
    at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178) 
    at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:68) 
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) 
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) 
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) 
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) 
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223) 
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203) 
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137) 
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:159) 
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286) 
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) 
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 
    at 

我沒有任何政策XML。該WSDL包括策略標籤:

<wsp:Policy wsu:Id="BN_BN_binding_SOAP12"> 
    <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" uri="http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true" /> 
    <saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional="true" /> 
    <wsp:ExactlyOne> 
    <wsp:All> 
     <sp:TransportBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sapsp="http://www.sap.com/webas/630/soap/features/security/policy" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"> 
      <wsp:Policy> 
       <sp:TransportToken> 
       <wsp:Policy> 
        <sp:HttpsToken> 
         <wsp:Policy> 
          <sp:HttpBasicAuthentication /> 
         </wsp:Policy> 
        </sp:HttpsToken> 
       </wsp:Policy> 
       </sp:TransportToken> 
       <sp:AlgorithmSuite> 
       <wsp:Policy> 
        <sp:Basic128Rsa15 /> 
       </wsp:Policy> 
       </sp:AlgorithmSuite> 
       <sp:Layout> 
       <wsp:Policy> 
        <sp:Strict /> 
       </wsp:Policy> 
       </sp:Layout> 
      </wsp:Policy> 
     </sp:TransportBinding> 
    </wsp:All> 
    </wsp:ExactlyOne> 
    <wsp:ExactlyOne> 
    <wsp:All> 
     <wsrmp:RMAssertion xmlns:wsrmp="http://docs.oasis-open.org/ws-rx/wsrmp/200702"> 
      <wsp:Policy /> 
     </wsrmp:RMAssertion> 
     <wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" /> 
    </wsp:All> 
    <wsp:All> 
     <wsrm:RMAssertion xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" /> 
     <wsaw:UsingAddressing xmlns:wsaw="http://schemas.xmlsoap.org/ws/2004/08/addressing" /> 
    </wsp:All> 
    </wsp:ExactlyOne> 

+0

嗨,你可以上傳你用它來看看它的結構策略XML –

+0

嗨,我沒有任何策略XML 。 wsdl包含策略標籤。我在說明中的例外末尾添加了策略詳細信息 –

回答

0

我已經解決了這一點。 我已經添加了標籤的CXF文件,並設置適當的安全證書 樣品CXF文件

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" 
    xmlns:http="http://cxf.apache.org/transports/http/configuration" 
    xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" 
    xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:cxf="http://cxf.apache.org/core" 
    xmlns:p="http://cxf.apache.org/policy" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans      
http://www.springframework.org/schema/beans/spring-beans.xsd   
http://cxf.apache.org/jaxws          
http://cxf.apache.org/schemas/jaxws.xsd   
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd   
http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd   
http://cxf.apache.org/transports/http/configuration    
http://cxf.apache.org/schemas/configuration/http-conf.xsd   
http://cxf.apache.org/transports/http-jetty/configuration  
http://cxf.apache.org/schemas/configuration/http-jetty.xsd   
http://cxf.apache.org/configuration/security      
http://cxf.apache.org/schemas/configuration/security.xsd "> 

    <cxf:bus> 
     <cxf:features> 
      <p:policies /> 
      <cxf:logging /> 
     </cxf:features> 
    </cxf:bus> 
    <jaxws:server id="CustomerSyncService" address="/customer_sync_service"> 
     <jaxws:serviceBean> 
      <bean class="com.CustomerService" /> 
     </jaxws:serviceBean> 
    </jaxws:server> 

</beans>