@Error updating database. Cause: java.lang.NullPointerException: temporalTOC
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.lang.NullPointerException: temporal
### The error may involve
xxxx.repo.mapper.xxxxxMapper.insertArch-Inline
### The error occurred while setting parameters
从报错看,可以确定是 xxxxxMapper.insertArch 这个类的这个方法执行时报错。
看这个方法,并没有什么问题。
@Insert({
xxxxxx
})
int insertArch(TaskPpTxnQuery record);
百思不得其解,后来通过对抛出异常仔细看,看到下面有如下,DateTimeFormaater. 通过代码确认 ArchivableTask.getJobMd5,是对其他一个日期字段进行format后算MD5,但是刚好这条数据的日期字段是个非法日期。所以导致该错误
Caused by: java.lang.NullPointerException: temporal
at java.util.Objects.requireNonNull(Objects.java:228)
at java.time.format.DateTimeFormatter.formatTo(DateTimeFormatter.java:1741)
at java.time.format.DateTimeFormatter.format(DateTimeFormatter.java:1720)
xxxxxxxxxxxxxxx ArchivableTask.getJobMd5(ArchivableTask.java:47)