0

运行弹簧批处理应用程序时出现以下错误

作业实例已存在且已完成,参数 ={}。如果要再次运行此作业,请更改参数。

我已经尝试过以下事情,并且有几次应用程序会启动,但大多数时候它都无法正常工作

JobParameters jobParameters = 
                      new JobParametersBuilder()
                      .addLong("time",System.currentTimeMillis()).toJobParameters();

                    JobExecution execution = jobLauncher.run(job, jobParameters);
                    System.out.println("Exit Status : " + execution.getStatus());

每 5 秒执行一次进程的代码。试图将其更改为 60 秒,但同样的问题。

 <bean id="runScheduler" class="com.test.sync.RunScheduler" /> <task:scheduled-tasks> <!-- <task:scheduled ref="runScheduler" method="run" fixed-delay="5000" /> --> <!-- fixed-delay use instead of cron post checking--> <task:scheduled ref="runScheduler" method="run" cron="*/5 * * * * *" /> </task:scheduled-tasks>

数据源

<property name="dataSource" ref="dataSource" />
        <property name="queryProvider">
            <bean
                class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
                <property name="dataSource" ref="dataSource" />
                <property name="selectClause" value="SELECT *" />
                <property name="fromClause" value="FROM TBL_CHANGE_EVENT" />
                <!--  include INpROGRESS AS -->
                <property name="whereClause" value="WHERE THREAD_KEY &gt;= :fromId AND THREAD_KEY &lt;= :toId AND STATUS in ('Not Started','In Progress')" />
                <property name="sortKey" value="EVENTTIME" />
            </bean>
        </property>


            <bean id="dataSource"
            class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
            --given my DB details
            <property name="url" value=" " />
            <property name="username" value="" />
            <property name="password" value="" />
        </bean>
4

0 回答 0