Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have added a simple jaxws configuration file to my spring 4 application:

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

And I am getting this error:

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

All of the info I can find says to include the dependency which I have done already:

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

I also have these cxf jars included as well:

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

I am using jboss EAP 7. I also tried running the application in JBoss EAP 6.4 and got the same issue. I have also tried excluding the web services module in the jboss-deployment-structure, but that caused other errors.

like image 256
mad_fox Avatar asked Dec 07 '22 22:12

mad_fox


1 Answers

You are using jax-ws and adding a dependency for jax-rs . WS is for SOAP and RS is for RESTful.

Add something like this:

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

Hope this helps.

like image 52
Sampada Avatar answered Jan 18 '23 15:01

Sampada