Spring NamespaceHandler – http://cxf.apache.org/transports/http/configuration

问题记录:

Configuration problem: Unable to locate Spring Namespace Handler for XML schema
namespace [http://cxf.apache.org/transports/http/configuration] 

>有什么线索可以解决这个问题?
>谁能看到我错过了什么?

环境:

Spring 4.0
Apache CXF : 2.7.7
WildFly App server

bean.xml

<?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:util="http://www.springframework.org/schema/util"
    xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schema/util/spring-util-2.5.xsd
    http://cxf.apache.org/transports/http/configuration
    http://cxf.apache.org/schemas/configuration/http-conf.xsd
    http://cxf.apache.org/jaxws
    http://cxf.apache.org/schema/jaxws.xsd">

 <http-conf:conduit name="*.http-conduit">
         <http-conf:client ReceiveTimeout="120000" ConnectionTimeout="120000" /> 
    </http-conf:conduit>

</beans>

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.test</groupId>
    <artifactId>b2cApplication</artifactId>
    <name>B2C Version</name>
    <version>3.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <url>http://jboss.org/richfaces</url>

 <build>
        <finalName>b2cApplication-3.0-SNAPSHOT</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>

                    <packagingExcludes>**/ojdbc14-10.2.0.3.0.jar,
                        **/asm*.jar,
                        **/cxf-2.4.0.jar,
                        **/cxf-manifest-2.4.0.jar,
                        **/ant-optional-1.5.1.jar,
                        **/activation-1.0.2.jar,
                        **/xalan-2.7.0.jar,
                        **/mail-1.3.jar,
                        **/xercesImpl-2.2.1.jar,
                        **/extranet-hotel-deduplicate-2.0.0.jar,
                        **/javassist-3.18.1-GA.jar,
                        **/cxf-api-2.7.7.jar,
                        **/cxf-rt-bindings-soap-2.7.7.jar,
                        **/cxf-rt-core-2.7.7.jar,
                        **/cxf-rt-databinding-jaxb-2.7.7.jar,
                        **/cxf-rt-frontend-simple-2.7.7.jar,
                        **/cxf-rt-transports-http-2.7.7,
                        **/cxf-rt-ws-addr-2.7.7.jar,
                        **/cxf-rt-ws-policy-2.7.7.jar,
                        **/cxf-rt-bindings-xml-2.7.7.jar,
                        **/cxf-rt-frontend-jaxws-2.7.7.jar,
                        **/cxf-rt-transports-http-2.7.7.jar,
                        **/neethi-3.0.0.jar,
                        **/servlet-api-2.5-6.1.5.jar,
                        **/velocity-1.3.jar,
                        **/mail-1.3.jar,
                        **/xerces-1.2.3.jar,
                        **/xercesImpl-2.9.1.jar,
                        **/ota-car-rentals-v2-2.0-SNAPSHOT.jar,
                        **/otasonata-FINAL.jar,
                        **/wagon*.jar,
                        **/doxia*.jar,
                        **/maven*.jar,
                        **/javaee-api-6.0.jar
                 </packagingExcludes>

                </configuration>

              <dependencies>

     <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
         <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>   


        <!-- Apache Commons -->
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
        </dependency>

        <!-- Apache POI -->
        <dependency>
            <groupId>org.apache.poi</groupId>
             <artifactId>poi-ooxml</artifactId>
            <version>3.10.1</version>
        </dependency>       
        <dependency>
            <groupId>org.apache.poi</groupId>
             <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.10.1</version>
        </dependency>    
         <dependency>
             <groupId>org.apache.poi</groupId>
             <artifactId>poi</artifactId>
            <version>3.10.1</version>
        </dependency>

        <!-- JoSQL -->
        <dependency>
            <groupId>JoSQL</groupId>
             <artifactId>JoSQL</artifactId>
                <version>1.9</version>
        </dependency>

        <dependency>
            <groupId>gently</groupId>
            <artifactId>gently</artifactId>
            <version>1.5</version>
        </dependency>

 <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-api</artifactId>
            <version>2.7.7</version>

        </dependency>

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

        </dependency>    

        <dependency>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
            <version>1.3.2</version>

        </dependency>

 </dependencies>

</project>

解决方法:

添加此依赖项:

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
    </dependency>

如果您查看此JAR,您将看到文件META-INF / spring.handlers:

http\://cxf.apache.org/transports/http/configuration=org.apache.cxf.transport.http.spring.NamespaceHandler

这说“如果有人要求http://cxf.apache.org/transports/http/configuration,那么委托给Java类org.apache.cxf.transport.http.spring.NamespaceHandler”

上一篇:CXF实现Restful WebService基础示例


下一篇:WebService学习笔记