微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我在 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用于SOAP,RS用于RESTful.

添加如下内容

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

希望这可以帮助.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。