无法找到 XML 模式命名空间的 Spring NamespaceHandler [http://cxf.apache.



我在 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> 

希望这有帮助。

最新更新