>

봄 부팅 응용 프로그램을 시작하려고 할 때 아래 오류가 발생합니다. 작업 매개 변수 인 작업 매개 변수를 제공하기 전에도 오류가 발생합니다.

논의가 많으면 file:#{jobParameters[controlFileInput]} 로 리소스를 사용하는 것이 좋습니다  이것을 해결하기 위해. 그러나 그것은 나를 위해 작동하지 않습니다. 미리 감사드립니다.

배치 XML

   <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:batch="http://www.springframework.org/schema/batch" 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"
    xsi:schemaLocation="http://www.springframework.org/schema/batch
    http://www.springframework.org/schema/batch/spring-batch-3.0.xsd
    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">
    <context:property-placeholder location="classpath:application.properties" />
    <bean id="stepScope" class="org.springframework.batch.core.scope.StepScope">
        <property name="autoProxy" value="true" />
    </bean>
    <bean id="billItemWriteListener"
        class="com.telstra.billubfreader.listener.BillItemWriteListener" />
    <bean id="billItemProcessListener"
        class="com.telstra.billubfreader.listener.BillItemProcessListener" />
    <bean id="fileMovingToErrorTasklet"class="com.telstra.billubfreader.ErrorFileMover" />
    <bean id="fileMovingToSuccessTasklet"
        class="com.telstra.billubfreader.SuccessFileMover" />
    <bean id="billControlFileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader"
        scope="step">
        <property name="resource" value="file:#{jobParameters[controlFileInput]}" />
        <property name="linesToSkip" value="${control.linetoskip}" />
        <property name="lineMapper">
            <bean class="com.telstra.billubfreader.mapper.BillControlLineMapper">
                <property name="lineTokenizer">
                    <bean   class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
                    </bean>
                </property>
                <property name="fieldSetMapper">
                    <bean
                        class="com.telstra.billubfreader.mapper.BillControlFieldDataMapper" />
                </property>
            </bean>
        </property>
    </bean>
    <bean id="billControlItemProcessor" class="com.telstra.billubfreader.BillControlItemProcessor"
        scope="step">
    </bean>
    <bean id="billControFileItemwriter" class="com.telstra.billubfreader.BillControlItemWriter"
        scope="step">
    </bean>

    <batch:job id="billControlFileReaderJob" restartable="true">
        <batch:step id="billControlFileRaderStep1">
            <batch:tasklet>
                <batch:chunk reader="billControlFileItemReader"
                    processor="billControlItemProcessor" writer="billControFileItemwriter"
                    commit-interval="25">
                    <batch:listeners>
                        <batch:listener ref="billItemWriteListener" />
                        <batch:listener ref="billItemProcessListener" />
                        <batch:listener ref="promotionListener"/>
                    </batch:listeners>
                </batch:chunk>
            </batch:tasklet>
             <batch:next on="FAILED" to="fileMovingtoError" />
              <batch:next on="COMPLETED" to="fileMovingToSuccess" />
        </batch:step>
        <batch:step id="fileMovingtoError">
        <tasklet ref="fileMovingToErrorTasklet"/>
        </batch:step>
        <batch:step id="fileMovingToSuccess">
        <tasklet ref="fileMovingToSuccessTasklet"/>
        </batch:step>
    </batch:job>
    <bean id="promotionListener"
class="org.springframework.batch.core.listener.ExecutionContextPromotionListener">
    <property name="keys" value="filesToMove"/>
</bean>
</beans>

로그

와이즈 비즈

2018-04-25 12:10:05.779 INFO 22716 --- [ main] o.s.batch.core.job.SimpleStepHandler : Step already complete or not restartable, so no action to execute: StepExecution: id=1, version=15, name=billControlFileRaderStep1, status=ABANDONED, exitStatus=FAILED, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=0, exitDescription=org.springframework.batch.item.ItemStreamException: Failed to initialize the reader at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy52.open(Unknown Source) at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:103) at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:310) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:197) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:66) at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:136) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:308) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:141) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:134 2018-04-25 12:10:06.201 INFO 22716 --- [ main] o.s.batch.core.job.SimpleStepHandler : Step already complete or not restartable, so no action to execute: StepExecution: id=2, version=3, name=fileMovingtoError, status=COMPLETED, exitStatus=COMPLETED, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=1, rollbackCount=0, exitDescription= 2018-04-25 12:10:06.334 INFO 22716 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : Job: [FlowJob: [name=billControlFileReaderJob]] complet


  • 답변 # 1

    여기에 문제가 있습니다. 문제는 SpringApplication.run 입니다.  작업을 시작하기 전에 작업을 실행하십시오. 따라서 직업 매개 변수가 없습니다. spring.batch.job.enabled = false로 문제를 해결했습니다.

관련 자료

  • 이전 javascript - JS/HTML을 사용하여 통화 흐름 메모/거품
  • 다음 java - ajax post에서 servlet으로 jsp로 리디렉션하려면 어떻게합니까?