Spring Batch无法找到XML命名空间错误的Spring NamespaceHandler

时间:2019-05-03 17:26:17

标签: spring spring-batch

我有一个Spring Batch作业,该作业立即失败。它可以在我的Eclipse环境中运行,也可以在生产环境中运行。但是,使用新笔记本电脑等时,现在出现此错误,导出时我没有答案。

我使用Maven创建可执行的jar文件。它已经运行了多年,但是现在在运行java -jar ...命令时出现此错误。

我读到此错误可能是由于缺少jar引起的。我在POM中确实有spring-context罐子...我不知道或不完全理解此错误。 xxxxxxx-launch-context.xml

使用Maven生成可执行文件时,如何丢失Spring jar?

我没有做过我从未做过的事情(我知道) 谢谢。

[INFO ]050319 104131 Failed. 'Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [xxxxxxx-launch-context.xml]
' (Launcher.java:111) 

这是exe里面的spring-context jar。

enter image description here

我的pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <version>1.0.0-RELEASE</version>
    <packaging>jar</packaging>
    <properties>
        <java-version>1.8</java-version>
        <target-java-version>1.8</target-java-version>
        <maven.test.failure.ignore>true</maven.test.failure.ignore>
        <spring.framework.version>4.1.6.RELEASE</spring.framework.version>
        <spring.batch.version>2.1.9.RELEASE</spring.batch.version>


 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <profiles>
        <profile>
            <id>strict</id>
            <properties>
                <maven.test.failure.ignore>false</maven.test.failure.ignore>
            </properties>
        </profile>
        <profile>
            <id>tiger</id>
            <activation>
                <jdk>1.5</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>javax.xml.stream</groupId>
                    <artifactId>com.springsource.javax.xml.stream</artifactId>
                    <version>1.0.1</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-core</artifactId>
            <version>${spring.batch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-infrastructure</artifactId>
            <version>${spring.batch.version}</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>

        <!-- APACHE -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.3.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-dbcp/commons-dbcp -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.13</version>
        </dependency>

        <!-- MAIL -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- GLAZERS -->
        <dependency>
            <groupId>com.glazers</groupId>
            <artifactId>gz-common-standalone</artifactId>
            <version>1.0.3-RELEASE</version>
        </dependency>

    </dependencies>

    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.6.0</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1</version>
                <configuration>
                    <mainClass>org.springframework.batch.core.launch.support.CommandLineJobRunner</mainClass>
                    <arguments>
                        job configuration file
                        <argument>classpath:/comptroller-launch-context.xml</argument>
                        job name
                        <argument>job1</argument>
                    </arguments>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <pluginRepositories>
        <pluginRepository>
            <id>Codehaus</id>
            <url>http://repository.codehaus.org/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

0 个答案:

没有答案