maven 2 - Spring Batch, JdbcExecutionContextDao java.util.Map$Entry deserializer issue, xstream 1.4.1 -


i have problem using spring batch 2.1.9: when use jobexplorer.getjobexecution(jobexecutionid), find problem when dao has deserialize string like:

{"map":[{"entry":{"string":"parsedcomparingdate","date":"2014-03-08 23:00:00.0 utc"}}]} 

from batch_job_execution_context table, using method jdbcjobexecutiondao.getjobexecution().

i know spring batch uses xstream 1.3, in pom, have:

  • spring-batch 2.1.9;
  • xstream 1.4.1 (inherited smooks);
  • jettison 1.3.3 (inherited cxf);

also, read xstream 1.3 not work fine jettison 1.3.3, using xstream 1.3 (excluding xstream 1.4.1 pom) job works correctly, while, using xstream 1.4.1 or major, find following exception:

caused by: java.lang.instantiationerror: java.util.map$entry         @ sun.reflect.generatedserializationconstructoraccessor1.newinstance(unknown source) [:1.6.0_23]         @ java.lang.reflect.constructor.newinstance(constructor.java:513) [rt.jar:1.6.0_23]         @ com.thoughtworks.xstream.converters.reflection.sun14reflectionprovider.newinstance(sun14reflectionprovider.java:75) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.converters.reflection.abstractreflectionconverter.instantiatenewinstance(abstractreflectionconverter.java:424) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.converters.reflection.abstractreflectionconverter.unmarshal(abstractreflectionconverter.java:229) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.treeunmarshaller.convert(treeunmarshaller.java:72) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.abstractreferenceunmarshaller.convert(abstractreferenceunmarshaller.java:65) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.treeunmarshaller.convertanother(treeunmarshaller.java:66) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.treeunmarshaller.convertanother(treeunmarshaller.java:50) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.converters.collections.abstractcollectionconverter.readitem(abstractcollectionconverter.java:71) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.converters.collections.mapconverter.putcurrententryintomap(mapconverter.java:85) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.converters.collections.mapconverter.populatemap(mapconverter.java:77) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.converters.collections.mapconverter.populatemap(mapconverter.java:71) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.converters.collections.mapconverter.unmarshal(mapconverter.java:66) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.treeunmarshaller.convert(treeunmarshaller.java:72) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.abstractreferenceunmarshaller.convert(abstractreferenceunmarshaller.java:65) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.treeunmarshaller.convertanother(treeunmarshaller.java:66) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.treeunmarshaller.convertanother(treeunmarshaller.java:50) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.treeunmarshaller.start(treeunmarshaller.java:134) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.core.abstracttreemarshallingstrategy.unmarshal(abstracttreemarshallingstrategy.java:32) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.xstream.unmarshal(xstream.java:1035) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.xstream.unmarshal(xstream.java:1019) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.xstream.fromxml(xstream.java:895) [xstream-1.4.1.jar:]         @ com.thoughtworks.xstream.xstream.fromxml(xstream.java:886) [xstream-1.4.1.jar:]         @ org.springframework.batch.core.repository.dao.xstreamexecutioncontextstringserializer.deserialize(xstreamexecutioncontextstringserializer.java:48) [spring-batch-core-2.1.9.release.jar:]         @ org.springframework.batch.core.repository.dao.jdbcexecutioncontextdao$executioncontextrowmapper.maprow(jdbcexecutioncontextdao.java:222) [spring-batch-core-2.1.9.release.jar:]         @ org.springframework.batch.core.repository.dao.jdbcexecutioncontextdao$executioncontextrowmapper.maprow(jdbcexecutioncontextdao.java:215) [spring-batch-core-2.1.9.release.jar:]         @ org.springframework.jdbc.core.rowmapperresultsetextractor.extractdata(rowmapperresultsetextractor.java:92) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.rowmapperresultsetextractor.extractdata(rowmapperresultsetextractor.java:60) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.jdbctemplate$1.doinpreparedstatement(jdbctemplate.java:649) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.jdbctemplate.execute(jdbctemplate.java:587) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.jdbctemplate.query(jdbctemplate.java:637) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.jdbctemplate.query(jdbctemplate.java:666) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.jdbctemplate.query(jdbctemplate.java:674) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.jdbctemplate.query(jdbctemplate.java:714) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.simple.simplejdbctemplate.query(simplejdbctemplate.java:202) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.jdbc.core.simple.simplejdbctemplate.query(simplejdbctemplate.java:209) [org.springframework.jdbc-3.2.1.release.jar:3.2.1.release]         @ org.springframework.batch.core.repository.dao.jdbcexecutioncontextdao.getexecutioncontext(jdbcexecutioncontextdao.java:106) [spring-batch-core-2.1.9.release.jar:] 

1) have seen code, can configure xstreamexecutioncontextstringserializer in order set reflectionprovider = null (in way, not uses provider) ?

2) there other solutions fix problem ?

thanks

it's impossible me change xstream version , jettison version because imported other components (like smooks).

a possible solution create 2 different jboss modules , use them togheter.

so, find solution: use spring-batch 2.2.0.release, , use org.springframework.batch.core.repository.dao.defaultexecutioncontextserializer serializer instead of xstream.

below configuration:

<bean id="batchdefaultserializer" class="org.springframework.batch.core.repository.dao.defaultexecutioncontextserializer" />  <bean id="jobrepository" class="org.springframework.batch.core.repository.support.jobrepositoryfactorybean">     <property name="datasource" ref="datasource" />     <property name="transactionmanager" ref="batchtransactionmanager" />     <property name="lobhandler" ref="defaultlobhandler" />     <property name="serializer" ref="batchdefaultserializer" /> </bean>         <bean id="jobexplorer"             class="org.springframework.batch.core.explore.support.jobexplorerfactorybean">     <property name="datasource" ref="datasource" />     <property name="serializer" ref="batchdefaultserializer" /> </bean> 

i tested , works fine, so, think it's best solution.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -