Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring batch 尝试使用SystemCommandTasklet分割文件-系统命令的执行未在超时内完成_Spring Batch - Fatal编程技术网

Spring batch 尝试使用SystemCommandTasklet分割文件-系统命令的执行未在超时内完成

Spring batch 尝试使用SystemCommandTasklet分割文件-系统命令的执行未在超时内完成,spring-batch,Spring Batch,我是使用SpringBatch的新手,我正在尝试获得SystemCommandTasklet函数的句柄。没有从代码中拆分文件。如果作为unix命令执行,split工作正常 <!-- spring batch core settings --> <import resource="../config/context.xml" /> <job id="accountingJob" xmlns="http://www.springframework.org/schem

我是使用SpringBatch的新手,我正在尝试获得SystemCommandTasklet函数的句柄。没有从代码中拆分文件。如果作为unix命令执行,split工作正常

<!-- spring batch core settings -->
<import resource="../config/context.xml" />


<job id="accountingJob" xmlns="http://www.springframework.org/schema/batch">

  <step id="step1" xmlns="http://www.springframework.org/schema/batch">

     <tasklet ref="fileSplittingTasklet" />              

</step>  
</job>

<!-- Jobs to run -->

<bean id="fileSplittingTasklet" class="org.springframework.batch.core.step.tasklet.SystemCommandTasklet" scope="step">
<property name="command" value="split -a 5 -l 4 #{jobParameters['inputFile']} #{jobParameters['stagingDirectory']}"/>
<property name="timeout" value="60000"/>
<property name="workingDirectory" value="/test/temp"/>  
}`

获取超时错误且未发生拆分。请从控制台中查找以下错误

INFO: Executing step: [step1]
2017年4月19日上午7:07:33 org.springframework.batch.core.step.AbstractStep执行 严重:执行步骤时遇到错误 org.springframework.batch.core.step.tasklet.SystemCommandException:系统命令的执行未在超时内完成 位于org.springframework.batch.core.step.tasklet.SystemCommandTasklet.execute(SystemCommandTasklet.java:109) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中 位于java.lang.reflect.Method.invoke(Method.java:606) 位于org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) 位于org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 在org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:150)上 位于org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) 位于org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) 位于org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:172) 位于org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 位于com.sun.proxy.$Proxy2.execute(未知源) 位于org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:395) 位于org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) 位于org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:267) 位于org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInitation(StepContextRepeatCallback.java:77) 位于org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368) 位于org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) 位于org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) 位于org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:253) 位于org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195) 位于org.springframework.batch.core.job.simplestphandler.handleStep(simplestphandler.java:137) 位于org.springframework.batch.core.job.flow.JobFlowExecutor.ExecuteTEP(JobFlowExecutor.java:64) 位于org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60) 位于org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:152) 位于org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:131) 位于org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) 位于org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301) 位于org.springframework.batch.core.launch.support.simplejoblancher$1.run(simplejoblancher.java:134) 位于org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) 位于org.springframework.batch.core.launch.support.simplejoblancher.run(simplejoblancher.java:127) 在com.mkyong.App.run上(App.java:32) 位于com.mkyong.App.main(App.java:15) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中 位于java.lang.reflect.Method.invoke(Method.java:606) 位于org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

2017年4月19日上午7:07:33 org.springframework.batch.core.launch.support.simplejoblancher$1运行 信息:作业:[FlowJob:[name=accountingJob]]已完成,参数为:[{}],状态为:[失败] 作业参数{} 退出状态:失败 作业参数SEXITCODE=失败;出口说明= 退出状态:[org.springframework.batch.core.step.tasklet.SystemCommandException:系统命令的执行未在超时内完成]
Done

作业参数“stagingDirectory”和“inputFile”在执行jar时未定义inputFile和stagingDirectory路径作为参数。例如:java-jar split.jar inputfile=split.txt stagingDirectoty/temp您确定参数已正确地从命令行转发到tasklet吗?在SystemCommandTasklet中放置制动点并检查发生了什么。享受吧!非常感谢卢卡·巴索·里奇。作业参数设置不正确。我已经改正了,效果很好。谢谢你的帮助。
INFO: Executing step: [step1]