java - Spring 批处理 : Invalid Content was found starting with element 'batch:job'

标签 java spring spring-batch

我在尝试运行系统时收到 SAXParserException 该标记无效。

下面是我的 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:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/batch 
http://www.springframework.org/schema/batch/spring-batch.xsd"
default-lazy-init="true">

<bean id="myItemProcessor" class="com.MyItemProcessor"/>
<bean id="myItemReader" class="com.MyItemReader"/>
<bean id="myItemWriter" class="com.MyItemWriter"/>

<batch:job id="helloWorldJob">
    <batch:step id="step1">
        <batch:tasklet>
            <batch:chunk reader="myItemReader" writer="myItemWriter"
                processor="myItemProcessor" commit-interval="10">
            </batch:chunk>
        </batch:tasklet>
    </batch:step>
</batch:job>

以下是我不断遇到的异常:

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'batch:job'.

尝试执行以下操作,但没有成功:

1) 尝试从类路径引用 xsd

2) 尝试修改 xsd 的不同点版本。但问题仍然是一样的。

我在这里做错了什么吗?

最佳答案

替换

http://www.springframework.org/schema/batch/spring-batch.xsd

http://www.springframework.org/schema/batch
    http://www.springframework.org/schema/batch/spring-batch-2.2.xsd

您错过了声明的一部分。

关于java - Spring 批处理 : Invalid Content was found starting with element 'batch:job' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41247100/

相关文章:

java - 我应该如何在 Android Studio 3.0.1 中导出到 zip 文件

java - 无法更改 HTTP 接受 header - 使用不同的语言环境解析策略

基于 Spring Security 一次性密码 (OTP) 的登录

spring - 值为 'class path resource [schema-mysql.sql]'的属性spring.datasource.schema无效: The specified resource does not exist

java - 出现 No bean nameed 'jobLauncher' available 异常

java - Apache pig UnsatisfiedLinkError

Java throttle 机制

java - 为什么我会收到 TransactionTooLargeException?

java - @PreUpdate 不适用于 Spring Data JPA

java - 根元素在 Spring Batch 中被多次写入