MattC가 지적한 것처럼 ItemProcessor
이 도청 당했을 때이 오류가 발생했습니다. 나의 예외가 있었다, 그래서 내 프로세서가 활동 중에 어떤 이유로, 들어,이 jobrepository
와 데이터 소스 연결을 종료했다 :
Encountered an error saving batch meta data for step step1 in job myjob. This job is now in an unknown state and should not be restarted.
org.springframework.dao.OptimisticLockingFailureException: Attempt to update step execution id=1 with wrong version (1), where current version is 2
을 스택 트레이스의 끝에서, 나는 발견 할 수 있었다 :
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection is closed.
문제를 확인하기 위해 먼저 위상을 분리합니다. 나는 NoOpProcessor와 NoOpItemWriter를 만들었다. 작업 표를 조정하면 잘 작동합니다. 그래서 제 문제는 독자가 아니 었습니다.
그런 다음 "전체"ItemWriter 구현으로 롤백하고 다시 제대로 작동했습니다. 그래서 제 문제는 작가가 아니 었습니다. "전체"프로세서를 활성화하면 오류가 다시 발생했습니다. 그래서 오류가 있었고 디버깅을 시작했습니다.
그래서, 불행하게도, 내 대답은 : 디버그 ...
public class NoOpProcessor implements ItemProcessor<Object, Object> {
@Override
public Object process(Object arg0) throws Exception {
System.out.println("Input object: " + Objects.toString(arg0));
return arg0;
}
}
public class NoOpItemWriter implements ItemWriter<Object> {
@Override
public void write(List<? extends Object> items) throws Exception {
if (items != null) {
System.out.println("Qtty of items to be written: " + items.size());
for (Object obj : items) {
System.out.println(Objects.toString(obj));
}
} else {
System.out.println("The items list is null. Nothing to be written.");
}
}
}
안녕 여기에 대한 업데이 트? – user2583922
해결 했습니까? – surlac
문제가 해결 될 수 있습니다. http://ashamathavan.blogspot.in/2010/12/optimisticlockingfailureexception.html –