잘 정리해보자
Spring Batch Error : Cannot change the ExecutorType when there is an existing transaction 본문
Spring/Spring Boot
Spring Batch Error : Cannot change the ExecutorType when there is an existing transaction
토마토오이 2022. 1. 10. 21:23
에러 메시지 :
org.springframework.dao.TransientDataAccessResourceException: Cannot change the ExecutorType when there is an existing transaction
발생 원인 :
배치 실행 시, AbstractPagingItemReader 로 read구현을 했는데, read함수 안에 paging처리 하면서 다른 dao도 함께 호출해서 발생.
-> paging처리 하는 reader트랜잭션이 동작중인데, 다른 mapper를 호출하면서 트랜잭션 충돌이 발생.
해결 :
paging처리하는 트랜잭션안에서 동작하려면 session을 열어서 같이 처리시키던가, bean으로 따로 만들어 처리.
저는 bean으로 따로 만들어서 처리했습니다.
processor bean으로 만들어 reader 후 processor로 log적재하는 mapper를 호출.
'Spring > Spring Boot' 카테고리의 다른 글
Spring Batch Error : org.springframework.dao.EmptyResultDataAccessException: Item 2 of 10 did not update any rows (0) | 2022.01.10 |
---|---|
https Error - PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException (0) | 2022.01.10 |
Nginx Error - 504 Gateway Time-out (0) | 2022.01.10 |
Spring Boot에 Swagger 적용 (3.0) (0) | 2022.01.05 |
Spring Cloud 개념 (0) | 2021.04.09 |
Comments