StaxEventItemWriter.unclosedHeaderCallbackElements prevents new job execution #4044
Labels
for: backport-to-4.3.x
Issues that will be back-ported to the 4.3.x line
has: minimal-example
Bug reports that provide a minimal complete reproducible example
in: core
type: bug
Milestone
While upgrading to spring-batch 4.3.4, my job started to fail with the exception :
The class with javax.xml.namespace.QName and name of javax.xml.namespace.QName is not trusted.
After investigating, it turns out that
StaxEventItemWriter
(with saveState=true) writes unclosed elements from the header callback to the step context asQNames
. On the next job execution, it will first try to read the last job execution and this is where the exception appears as the step execution fromStaxEventItemWriter
cannot be deserialized.This was not a problem before 4.3.4 as
SimpleJobExplorer#getLastJobExecution
did not fetch step executions (see #3943) but now that it does, it means thatStaxEventItemWriter
is not usable with a header callback out-of-the-box. EIther we have to setsaveState=false
on the writer, or we must create a BatchConfigurer to add the mixIn forQName
to theObjectMapper
.I think that at the very least, documentation should reflect this.
Minimal example : https://github.com/Alex4i/staxwriter_qname
Run with
gradlew bootRun
The text was updated successfully, but these errors were encountered: