我在运行批处理作业时遇到此错误。我是Spring Batch的新手,所以大家帮忙,因为我没有知道这个错误。我的系统中没有其他批处理作业也在运行。
我的root-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<import resource="job-context.xml"/>
<aop:aspectj-autoproxy />
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg><ref bean="dataSource" /></constructor-arg>
</bean>
<bean id="dataSource" class="com.qr.jadu.tx.conpoolrouter.DataSourceRouter">
<property name="targetDataSources">
<map key-type="com.qr.jadu.tx.conpoolrouter.TransactionTypes">
<entry key="RO" value-ref="schedules-read-dataSource" />
<entry key="RW" value-ref="schedules-write-dataSource" />
</map>
</property>
<property name="defaultTargetDataSource" ref="schedules-read-dataSource" />
</bean>
<bean id="masters-read-dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/masterDatabase"/>
</bean>
<bean id="schedules-read-dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/scheduleDatabase"/>
</bean>
<bean id="schedules-write-dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/scheduleDatabase"/>
</bean>
<bean id="security-read-dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/sysDs"/>
</bean>
<bean id="csp-read-dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/cspDatabase"/>
</bean>
<bean id="schedules-punitpostprocessor" class="com.qr.jadu.entity.helper.JaduPersistenceUnitPostProcessor">
<property name="locationPatterns">
<list>
<value>classpath*:com/croamis/**/*.class</value>
</list>
</property>
</bean>
<alias name="schedules-dataSource" alias="lov-dataSource"/>
<bean id="schedules-entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<value>com.croamis.schedules</value>
</property>
<property name="persistenceUnitName" value="schedulesPU" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
</bean>
</property>
<property name="persistenceUnitPostProcessors">
<list>
<ref bean="schedules-punitpostprocessor" />
</list>
</property>
<property name="jpaProperties">
<!-- To run with MySQL -->
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
</props>
<!-- To run with Oracle -->
<!--
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
</props>
-->
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="schedules-entityManagerFactory" />
</bean>
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" />
我的job-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema /batch/spring-batch-2.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<job id="GenerateOperationalFlightJob" xmlns="http://www.springframework.org/schema/batch">
<step id="step1">
<tasklet task-executor="taskexecutor">
<chunk reader="ScheduleRecordsAdapter" processor="scheduleRecordProcessor" writer="operationalFlightWriter" commit-interval="1">
</chunk>
</tasklet>
</step>
<bean id="ScheduleRecordsAdapter" class="org.springframework.batch.item.adapter.ItemReaderAdapter">
<property name="targetObject" ref="scheduleRecordsRetrievalAdapter"/>
<property name="targetMethod" value="getScheduleRecord"/>
</bean>
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseType" value="mysql" />
<property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/>
</bean>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
</beans>