错误配置:无法找到XML架构命名空间的Spring NamespaceHandler

时间:2017-11-15 13:47:46

标签: spring spring-integration spring-integration-sftp

我在弹簧服务应用程序中遇到错误。请帮助我。由于以下错误,文本初始化失败。

错误

上下文初始化失败 rg.springframework.beans.factory.parsing.BeanDefinitionParsingException: 配置问题:无法找到XML架构命名空间的Spring NamespaceHandler [http://www.springframework.org/schem/integration/ftp] Spring配置

<?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:int="http://www.springframework.org/schema/integration"
   xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
   xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp 
http://www.springframework.org/schema/integration/ftp/spring-integration-
ftp.xsd
            http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    <property name="host" value="test.rebex.net"/>
    <property name="port" value="21"/>
    <property name="username" value="demo"/>
    <property name="password" value="password"/>
</bean>

<int-ftp:inbound-channel-adapter id="ftpInbound"
            channel="ftpChannel"
            session-factory="ftpClientFactory"
            filename-pattern="readme.txt"
            auto-create-local-directory="true"
            delete-remote-files="false"
            remote-directory="/pub/example/"
            local-directory="C:/Users/TOOW10/temp/">
        <int:poller fixed-rate="1000"/>
</int-ftp:inbound-channel-adapter>

<int:channel id="ftpChannel">
    <int:queue/>
</int:channel>

pom.xml

    <dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.25.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.5</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.annotation/jsr250-api -->
    <!-- https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305 -->
    <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>jsr305</artifactId>
        <version>2.0.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.9</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-core</artifactId>
        <version>4.1.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>com.hybris.datahub</groupId>
        <artifactId>datahub-extension-sdk</artifactId>
        <version>6.5.0.0-RC3</version>
        <scope>provided</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.integration/spring-integration-ftp -->
    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-ftp</artifactId>
        <version>4.1.0.RELEASE</version>
    </dependency>


</dependencies>
<properties>
    <spring.version>4.3.3.RELEASE</spring.version>
</properties>

1 个答案:

答案 0 :(得分:0)

您似乎在integration-ftp.xsd之间有了新的一行。我得到了一个不同的错误,但应该修复。

如果这不是问题,那么你的类路径有问题。仔细检查maven是否已将spring-integration-ftp jar放在类路径上。