gpt4 book ai didi

java - Spring 批处理 : NotSerializableException

转载 作者:行者123 更新时间:2023-12-01 18:19:16 25 4
gpt4 key购买 nike

我有 Spring 批处理作业使用的 pojo 类。

public class DataItem{
String key;
CellType type; //Enum
String name;

private XSSFCell cell; //org.apache.poi.xssf.usermodel.XSSFCell


//getters setters omitted
}

当我尝试运行批处理作业时,出现以下异常:

java.lang.IllegalArgumentException: Failed to serialize object of type: class org.springframework.batch.core.JobExecution
at org.springframework.util.SerializationUtils.serialize(SerializationUtils.java:49)
at org.springframework.batch.core.repository.dao.MapJobExecutionDao.copy(MapJobExecutionDao.java:50)
at org.springframework.batch.core.repository.dao.MapJobExecutionDao.updateJobExecution(MapJobExecutionDao.java:104)
at org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:162)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:351)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128)
at com.excelreader.AppMain.run(AppMain.java:35)
at com.excelreader.AppMain.main(AppMain.java:16)
Caused by: java.io.NotSerializableException: com.excelreader.pojo.DataItem

最佳答案

DataItem 及其内部的所有内容都必须实现 Serialized 接口(interface)。这就是您收到此异常的原因。

关于java - Spring 批处理 : NotSerializableException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28020746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com