无法找到 XML 架构命名空间 [http://cxf.apache.org/jaxws] 的 Spring NamespaceHandler - 包括 cxf-rt-frontend-jaxrs

Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws] - cxf-rt-frontend-jaxrs included

我已经在我的 spring 4 应用程序中添加了一个简单的 jaxws 配置文件:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:jaxws="http://cxf.apache.org/jaxws"
   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">

    <jaxws:client name="https://testecommerce.credibanco.com/vpos2/services/VPOSWS20SOAP/authorize" createdFromAPI="true">
        <!-- Uncomment if using WS-SecPolicy method -->
        <jaxws:properties>
            <entry key="ws-security.username" value="myuser"/>        
            <entry key="ws-security.callback-handler" value-ref="mypassword"/>
        </jaxws:properties>
    </jaxws:client>

    <bean id="myPasswordCallback" class="com..core.ws.security.PWHandler"/>

</beans>

我收到这个错误:

Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]

我能找到的所有信息都说包括我已经完成的依赖项:

        <dependency>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-rt-frontend-jaxrs</artifactId>
          <version>3.1.4</version>
        </dependency>

我也有这些 cxf 罐子:

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-transports-http-hc</artifactId>
    <version>${cxf.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-bindings-soap</artifactId>
    <version>${cxf.version}</version>
    <scope>provided</scope>
</dependency>
<dependency>
   <groupId>org.apache.cxf</groupId>
   <artifactId>cxf-rt-ws-security</artifactId>
   <version>${cxf.version}</version>
   <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.apache.wss4j</groupId>
    <artifactId>wss4j-ws-security-common</artifactId>
    <version>2.1.5</version>
</dependency>

我正在使用 jboss EAP 7。我还尝试 运行 JBoss EAP 6.4 中的应用程序并遇到了同样的问题。我也曾尝试在 jboss-deployment-structure 中排除 Web 服务模块,但这导致了其他错误。

您正在使用 jax-ws 并为 jax-rs 添加依赖项。 WS 用于 SOAPRS 用于 RESTful.

添加如下内容:

 <dependency>
     <groupId>org.apache.cxf</groupId>
     <artifactId>cxf-rt-frontend-jaxws</artifactId>
     <version>2.7.7</version>
 </dependency> 

希望对您有所帮助。