Java cvc complex type.2.4.c:匹配的通配符是严格的,但是找不到元素';批处理:作业';
在批处理的applicationContext.xml中出现此错误 applicationContext如下所示:Java cvc complex type.2.4.c:匹配的通配符是严格的,但是找不到元素';批处理:作业';,java,spring,spring-batch,Java,Spring,Spring Batch,在批处理的applicationContext.xml中出现此错误 applicationContext如下所示: <?xml version='1.0' encoding='UTF-8'?> <beans xmlns:batch='http://www.springframework.org/schema/batch' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:context='h
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns:batch='http://www.springframework.org/schema/batch'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:context='http://www.springframework.org/schema/context'
xmlns:tx='http://www.springframework.org/schema/tx'
xmlns='http://www.springframework.org/schema/beans'
xsi:schemaLocation='http://www.springframework.org/schema/batch
http://www.springframework.org/schema/spring-batch.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd'>
<import resource="datasource-tx-jpa.xml" />
<!-- we can use annotations -->
<context:annotation-config />
<!-- package to look for annotated classes -->
<context:component-scan base-package='com.anirban.batch' />
<!-- we will manage transactions with annotations -->
<tx:annotation-driven />
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="databaseType" value="oracle" />
<property name="dataSource" ref="myDataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="isolationLevelForCreate" value="ISOLATION_DEFAULT" />
</bean>
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<!-- XML Marshaller -->
<bean id="matchMarshaller" class="org.springframework.oxm.castor.CastorMarshaller">
<property name="mappingLocation" value="oxm-mapping.xml" />
</bean>
<!-- Batch job: Contact import -->
<batch:job id="importContactJob">
<batch:step id="readWriteStep">
<batch:tasklet transactionManager="transactionManager">
<batch:chunk reader="contactItemReader" processor="contactItemProcessor"
writer="contactItemWriter" commit-interval="4" />
</batch:tasklet>
</batch:step>
<batch:listners>
<batch:listner ref="importContactJoblistener" />
</batch:listners>
</batch:job>
<bean id="contactItemReader" class="org.springframework.batch.item.xml.StaxEventItemReader">
<property name="resource" value="file:///#{jobParameters['contact.xml']" />
<property name="fragmentRootElementName" value="person" />
<property name="unMarshaller" ref="batchMarshaller" />
</bean>
<bean id="contactItemWriter"
class="org.springframework.batch.item.adapter.ItemWriterAdapter">
<property name="targetObject" value="PersonDao" />
<property name="targetMethod" value="save" />
</bean>
<bean id="personDao" class="com.anirban.batch.dao.impl.PersonDaoImpl" />
<!-- <property name="sessionFactory" ref="mySessionFactory"/> </bean> -->
<bean id="log4jInitialization"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
<property name="targetMethod" value="initLogging" />
<property name="arguments">
<list>
<value>log4j.properties</value>
</list>
</property>
</bean>
</beans>
及
读取架构文档失败'http://www.springframework.org/schema/spring-batch.xsd,因为1)找不到该文档;2) 文件无法读取;3) 文档的根元素不是。
POM依赖项:
<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>
org.springframework.batch
弹簧批芯
${spring batch.version}
org.springframework.batch
spring批处理基础架构
${spring batch.version}
Maven依赖项中可用的批处理JAR
1.spring-batch-core-2.2.0.RELEASE.jar
2.spring-batch-infrastructure-2.2.0.RELEASE.jar
有人能帮忙吗?这通常是一个类路径问题。你确定你的类路径上有批处理JAR吗?是的。下面是为batch org.springframework.batch spring batch core${spring batch.version}org.springframework.batch spring batch infrastructure${spring batch.version}添加的依赖项。提供更多信息时,请编辑您的问题。。不要使用注释。而且,这只是POM的依赖项。我在问那些罐子是否真的在那里。你是如何打包/运行你的应用程序的?@MichaelMinella是的。JAR在maven依赖项中可用。我正在使用STS。尝试通过主方法直接从STS运行。请使用最新的spring版本。“3.0.1.发行版”或更高版本。。
Failed to read schema document 'http://www.springframework.org/schema/spring-batch.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
<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>