小编Giu*_*ldo的帖子

Spring Batch,JdbcExecutionContextDao java.util.Map $ Entry反序列化器问题,xstream 1.4.1

我在使用Spring Batch 2.1.9时遇到问题:当我使用jobExplorer.getJobExecution(jobExecutionId)时,当DAO必须反序列化一个字符串时,我发现了一个问题:

{"map":[{"entry":{"string":"parsedComparingDate","date":"2014-03-08 23:00:00.0 UTC"}}]}
Run Code Online (Sandbox Code Playgroud)

使用方法从BATCH_JOB_EXECUTION_CONTEXT表中获取JdbcJobExecutionDao.getJobExecution()

我知道spring批处理使用xstream 1.3,但是在我的Pom中,我有:

  • 春季批次2.1.9 ;
  • xstream 1.4.1(从smook继承);
  • 抛弃1.3.3(继承自cxf);

此外,我读到xstream 1.3不能与jettison 1.3.3一起正常工作,但是使用xstream 1.3(不包括pom的xstream 1.4.1)可以正常工作,而使用xstream 1.4.1或主要版本时,我发现以下异常:

Caused by: java.lang.InstantiationError: java.util.Map$Entry
        at sun.reflect.GeneratedSerializationConstructorAccessor1.newInstance(Unknown Source) [:1.6.0_23]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_23]
        at com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.newInstance(Sun14ReflectionProvider.java:75) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:424) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:229) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryIntoMap(MapConverter.java:85) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:77) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:71) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:66) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) [xstream-1.4.1.jar:]
        at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) …
Run Code Online (Sandbox Code Playgroud)

java maven-2 xstream jettison spring-batch

5
推荐指数
1
解决办法
3790
查看次数

标签 统计

java ×1

jettison ×1

maven-2 ×1

spring-batch ×1

xstream ×1