본문 바로가기
Study_Framework

[Spring] Spring Batch + MariaDB 관련 에러 - Unexpected cursor position change 에러 발생

by 타블로 2023. 3. 26.

# 에러 내요 일부 

Unexpected cursor position change 에러 발생

 

org.springframework.dao.InvalidDataAccessResourceUsageException: Unexpected cursor position change.
at org.springframework.batch.item.database.AbstractCursorItemReader.verifyCursorPosition(AbstractCursorItemReader.java:395) ~[spring-batch-infrastructure-4.3.8.jar:4.3.8]
at org.springframework.batch.item.database.AbstractCursorItemReader.doRead(AbstractCursorItemReader.java:506) ~[spring-batch-infrastructure-4.3.8.jar:4.3.8]
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:93) ~[spring-batch-infrastructure-4.3.8.jar:4.3.8]

 

(생략)

 

2023-03-26 17:28:10.104 DEBUG 6293 --- [   scheduling-1] o.s.b.c.r.dao.JdbcStepExecutionDao       : Truncating long message before update of StepExecution, original message is: org.springframework.dao.InvalidDataAccessResourceUsageException: Unexpected cursor position change.
at org.springframework.batch.item.database.AbstractCursorItemReader.verifyCursorPosition(AbstractCursorItemReader.java:395)
at org.springframework.batch.item.database.AbstractCursorItemReader.doRead(AbstractCursorItemReader.java:506)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:93)

 

(생략)

 

2023-03-26 17:28:10.107 DEBUG 6293 --- [   scheduling-1] o.s.batch.core.step.AbstractStep         : Step execution complete: StepExecution: id=100, version=2, name=jobStep2, status=FAILED, exitStatus=FAILED, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=1
2023-03-26 17:28:10.108 DEBUG 6293 --- [   scheduling-1] o.s.batch.core.job.AbstractJob           : Upgrading JobExecution status: StepExecution: id=100, version=2, name=jobStep2, status=FAILED, exitStatus=FAILED, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=1, exitDescription=org.springframework.dao.InvalidDataAccessResourceUsageException: Unexpected cursor position change.
at org.springframework.batch.item.database.AbstractCursorItemReader.verifyCursorPosition(AbstractCursorItemReader.java:395)
at org.springframework.batch.item.database.AbstractCursorItemReader.doRead(AbstractCursorItemReader.java:506)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:93)

 

# 해결 방법

- mariadb 대신 maysql로 변경

1. pom.xml 기준 : dependency 변경

2. application.yml 기준 : spring.datasource.url, spring.datasource.driver-class-name 변경