inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 배치

어플리케이션 예제 (4)

apiJob 실행시IllegalArgumentException 발생

1211

goodbyeyo4

작성한 질문수 2

0

안녕하세요 강의 잘 듣고 있습니다.
 
실습 프로젝트 코드 작성해서 apiJob 실행했더니 아래와 같은 에러가 발생합니다.
 
해당문제는 sprinb batch version으로 인한 문제인걸로 보이는데 (물론 오타로 인한 에러를 찾지 못하고 있을수도 있습니다) 구글링과 에러내용에서 권장하는 ObjecpMapper를 이용해도 동일한 에러가 발생해서 해결방법을 알려주시면 감사하겠습니다.
 
# 이슈
https://github.com/spring-projects/spring-batch/issues/3732
 
# Source Git Repository
https://github.com/goodbyeyo/spring-batch
 
 
# 에러내용
java.lang.IllegalArgumentException: Unable to deserialize the execution context
 
Caused by: com.fasterxml.jackson.databind.JsonMappingException: The class with study.batch.batchService.domain.ProductVO and name of study.batch.batchService.domain.ProductVO is not trusted. If you believe this class is safe to deserialize, you can add it to the base set of trusted classes at construction time or provide an explicit mapping using Jackson annotations or a custom ObjectMapper. If the serialization is only done by a trusted source, you can also enable default typing. (through reference chain: java.util.HashMap["product"])
 
Caused by: java.lang.IllegalArgumentException: The class with study.batch.batchService.domain.ProductVO and name of study.batch.batchService.domain.ProductVO is not trusted. If you believe this class is safe to deserialize, you can add it to the base set of trusted classes at construction time or provide an explicit mapping using Jackson annotations or a custom ObjectMapper. If the serialization is only done by a trusted source, you can also enable default typing.
 
 
 

spring-boot spring-batch

답변 1

0

정수원

일단 코드를 받아서 실행 시켜 보면 오류가 나는데 

ApiStepConfiguration 의

public ItemReader<ProductVO> itemReader(@Value("#{stepExecutionContext['product']}") 
ProductVO productVO) throws Exception {

에 @Bean 과 @StepScope 가 빠져 있어 추가 하니 기동은 되었습니다.

@StepScope
@Bean
public ItemReader<ProductVO> itemReader(@Value("#{stepExecutionContext['product']}") 
                                            ProductVO productVO) throws Exception

그리고 DB 에도 값이 정상적으로 입력이 되어 있습니다.

제가 실행해보니 질문하신 에러가 발생하지는 않습니다.

에러 재현을 위해서는 좀 더 자세한 상황에 대한 설명이 필요할 것 같습니다.

스프링 배치 버전 질문

0

141

1

소스코드가 어디에 있나요?

0

122

2

트랜잭션 예외

0

101

1

질문이 있습니다.

0

140

2

ChunkListener 에서 beforeChunk 의 실행 시점 관련 질문

0

146

2

여러 JOB 설정하는법

0

158

2

강의 자료 다른 방법 있을까요?

0

163

1

JobExecution과 JobExecutionContext와의 관계

0

199

2

특정 job만 실행

1

271

1

Batch 성능 질문

0

158

1

ItemReaderAdapter 종료

0

87

1

[ 강좌 Git 브랜치 문의 ] 섹션 9 > JdbcCursorItemReader, JpaCursorItemReader

0

191

2

Spring Batch 배포 질문

0

255

2

spring batch 버전

0

239

2

retry count 관련 질문

0

185

2

StepExecutionListener 의 afterStep 에서 return ExitStatus.FAILED 에 의한 동작에 의문이 갑니다.

0

346

2

jdbc, jpa 커서방식 조회 방식 차이 질문 (강사님께 답변 받고 싶습니다)

0

242

2

Multithread step과 AsyncItemProcessor

0

208

2

job 재실행

0

259

2

bean 생명주기 문제 도와주세요(@Scope("step"), @Autowired)

0

192

1

Multi-threaded-step과 Partitioning 차이 확인

0

186

2

jdbcCursorReader, jdbcPagingReader 질문

0

149

1

step muti-thread 질문

0

114

1

itemSteam open update close 질문

0

120

1