title: spring batch exception Cannot construct java.util.Map$Entry
body: <p>We are facing following exception while executing spring batch job from command line. 
          Spring Batch Version - 3.0.2.RELEASE
          Spring Version - 4.0.0.RELEASE
          xStream version - 1.4.7
          Data Base - mysql (I am connecting to new DB schema.)
          While executing a job using following command, I am getting below exception...</p>
  
  <pre><code>    java %JAVA_OPTS% org.springframework.batch.core.launch.support.CommandLineJobRunner config/spring-config.xml partitionJdbcJob
  
      Exception
      ----------
  
      INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
      Feb 20, 2015 3:22:28 PM org.springframework.batch.core.launch.support.SimpleJobLauncher afterPropertiesSet
      INFO: No TaskExecutor has been set, defaulting to synchronous executor.
      Feb 20, 2015 3:22:29 PM org.springframework.batch.core.launch.support.SimpleJobLauncher run
      INFO: Job: [FlowJob: [name=partitionJdbcJob]] launched with the following parameters: [{}]
      Feb 20, 2015 3:22:29 PM org.springframework.batch.core.job.AbstractJob execute
  
      SEVERE: Encountered fatal error executing job
      org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly
              at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:140)
              at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304)
              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 org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:362)
              at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:590)
      Caused by: org.springframework.batch.core.job.flow.FlowExecutionException: Ended flow=partitionJdbcJob at state=partitionJdbcJob.step with exception
              at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:174)
              at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
              at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134)
              ... 6 more
      Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct java.util.Map$Entry : java.util.Map$Entry : Cannot construct java.util.Map$
      Entry : java.util.Map$Entry
  
      ---- Debugging information ----
      message             : Cannot construct java.util.Map$Entry : java.util.Map$Entry
      cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
      cause-message       : Cannot construct java.util.Map$Entry : java.util.Map$Entry
      class               : java.util.Map$Entry
      required-type       : java.util.Map$Entry
      converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
      path                : /map/map/entry
      line number         : -1
      class[1]            : java.util.HashMap
      converter-type[1]   : com.thoughtworks.xstream.converters.collections.MapConverter
      version             : 1.4.7
      -------------------------------
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
              at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
              at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
              at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryIntoMap(MapConverter.java:106)
              at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
              at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
              at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
              at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
              at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
              at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
              at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
              at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
              at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
              at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1031)
              at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.deserialize(XStreamExecutionContextStringSerializer.java:112)
              at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.deserialize(XStreamExecutionContextStringSerializer.java:45)
              at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:322)
              at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:309)
              at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
              at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60)
              at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:706)
              at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:642)
              at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:693)
              at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:725)
              at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:735)
              at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:790)
              at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.getExecutionContext(JdbcExecutionContextDao.java:127)
              at org.springframework.batch.core.repository.support.SimpleJobRepository.getLastStepExecution(SimpleJobRepository.java:238)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
              at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
              at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
              at $Proxy7.getLastStepExecution(Unknown Source)
              at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:115)
              at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
              at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)
              at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:165)
              ... 8 more
      Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct java.util.Map$Entry : java.util.Map$Entry
              at com.thoughtworks.xstream.converters.reflection.SunLimitedUnsafeReflectionProvider.newInstance(SunLimitedUnsafeReflectionProvider.java:80)
              at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:553)
              at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:256)
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
              ... 57 more
      Caused by: java.lang.InstantiationException: java.util.Map$Entry
              at sun.misc.Unsafe.allocateInstance(Native Method)
              at com.thoughtworks.xstream.converters.reflection.SunLimitedUnsafeReflectionProvider.newInstance(SunLimitedUnsafeReflectionProvider.java:76)
              ... 60 more
  Spring Config
  ----------------
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:task="http://www.springframework.org/schema/task"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
                              http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
                              http://www.springframework.org/schema/context
                              http://www.springframework.org/schema/context/spring-context-4.0.xsd
                              http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
                              http://www.springframework.org/schema/task 
                              http://www.springframework.org/schema/task/spring-task-3.2.xsd"&gt;
  
      &lt;context:annotation-config /&gt; 
  
      &lt;bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
          &lt;property name="url" value="jdbc:mysql://localhost:3306/newspringbatch?useServerPrepStmts=false&amp;amp;rewriteBatchedStatements=true" /&gt;
          &lt;property name="username" value="uid" /&gt;
          &lt;property name="password" value="pwd" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager"
          class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" /&gt;
  
      &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"&gt;
          &lt;constructor-arg ref="pooledDS" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- DB Pooling --&gt;
      &lt;bean id="pool" class="org.apache.commons.pool.impl.GenericObjectPool"&gt;
          &lt;property name="minEvictableIdleTimeMillis"&gt;&lt;value&gt;300000&lt;/value&gt;&lt;/property&gt;
          &lt;property name="timeBetweenEvictionRunsMillis"&gt;&lt;value&gt;60000&lt;/value&gt;&lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="dsConnectionFactory" class="org.apache.commons.dbcp.DataSourceConnectionFactory"&gt;
          &lt;constructor-arg&gt;&lt;ref bean="dataSource"/&gt;&lt;/constructor-arg&gt;
      &lt;/bean&gt;
  
      &lt;bean id="poolableConnectionFactory" class="org.apache.commons.dbcp.PoolableConnectionFactory"&gt;
          &lt;constructor-arg index="0"&gt;&lt;ref bean="dsConnectionFactory"/&gt;&lt;/constructor-arg&gt;
          &lt;constructor-arg index="1"&gt;&lt;ref bean="pool"/&gt;&lt;/constructor-arg&gt;
          &lt;constructor-arg index="2"&gt;&lt;null/&gt;&lt;/constructor-arg&gt;
          &lt;constructor-arg index="3"&gt;&lt;null/&gt;&lt;/constructor-arg&gt;
          &lt;constructor-arg index="4"&gt;&lt;value&gt;false&lt;/value&gt;&lt;/constructor-arg&gt;
          &lt;constructor-arg index="5"&gt;&lt;value&gt;true&lt;/value&gt;&lt;/constructor-arg&gt;
      &lt;/bean&gt;
  
      &lt;bean id="pooledDS" class="org.apache.commons.dbcp.PoolingDataSource" depends-on="poolableConnectionFactory"&gt;
          &lt;constructor-arg&gt;&lt;ref bean="pool"/&gt;&lt;/constructor-arg&gt;
      &lt;/bean&gt;
  
      &lt;!-- stored job-meta in database --&gt;
      &lt;bean id="batchDefaultSerializer" class="org.springframework.batch.core.repository.dao.DefaultExecutionContextSerializer" /&gt;
  
  
      &lt;bean id="jobRepository"
          class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"&gt;
          &lt;property name="dataSource" ref="pooledDS" /&gt;
          &lt;property name="transactionManager" ref="transactionManager" /&gt;
          &lt;property name="databaseType" value="mysql" /&gt;  
  
      &lt;/bean&gt;
  
      &lt;bean id="jobLauncher"
          class="org.springframework.batch.core.launch.support.SimpleJobLauncher"&gt;
          &lt;property name="jobRepository" ref="jobRepository" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"&gt;&lt;/bean&gt;
  
      &lt;bean id="userUnmarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"&gt;&lt;/bean&gt;
  
      &lt;job id="partitionJdbcJob" restartable="true" xmlns="http://www.springframework.org/schema/batch"&gt;  
          &lt;step id="step" &gt;
              &lt;partition step="createFiles" partitioner="partitioner"&gt;
                  &lt;handler grid-size="50" task-executor="taskExecutor" /&gt;
              &lt;/partition&gt;
          &lt;/step&gt;
          &lt;listeners&gt;
              &lt;listener ref="jobDurationListener" /&gt;
          &lt;/listeners&gt;
      &lt;/job&gt;
  
      &lt;step id="createFiles" xmlns="http://www.springframework.org/schema/batch"&gt;
          &lt;tasklet&gt;
              &lt;chunk reader="pagingItemReader" processor="filesItemProcessor"
                  writer="filesItemWriter" commit-interval="200" /&gt;
          &lt;/tasklet&gt;
      &lt;/step&gt;
  
      &lt;!-- PagingItemReader will be used for big records only --&gt;
      &lt;bean id="pagingItemReader" class="org.springframework.batch.item.database.JdbcPagingItemReader"
          scope="step" autowire-candidate="false"&gt;
          &lt;property name="dataSource" ref="pooledDS" /&gt;
          &lt;property name="rowMapper" ref="reconRowMapper" /&gt;
          &lt;!-- Query Provider --&gt;
          &lt;property name="queryProvider"&gt;
              &lt;bean
                  class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean"&gt;
                  &lt;property name="dataSource" ref="pooledDS" /&gt;
                  &lt;property name="fromClause" value="from sample" /&gt;
                  &lt;property name="selectClause" value="id,name" /&gt;
                  &lt;property name="sortKey" value="id" /&gt;
  
              &lt;/bean&gt;
          &lt;/property&gt;
  
          &lt;!-- Inject via the ExecutionContext in partitioner --&gt;
          &lt;property name="parameterValues"&gt;
              &lt;map&gt;
                  &lt;entry key="minId" value="#{stepExecutionContext[minValue]}" /&gt;
                  &lt;entry key="maxId" value="#{stepExecutionContext[maxValue]}" /&gt;
              &lt;/map&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="filesItemProcessor" class="com.batch.job.ResultProcessor" /&gt;
  
      &lt;bean id="filesItemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter"
          scope="step"&gt;
          &lt;property name="resource" value="#{stepExecutionContext[outputFile]}" /&gt;
          &lt;property name="shouldDeleteIfExists" value="true" /&gt;
          &lt;property name="lineAggregator"&gt;
              &lt;bean
                  class="org.springframework.batch.item.file.transform.DelimitedLineAggregator"&gt;
                  &lt;property name="delimiter" value="," /&gt;
                  &lt;property name="fieldExtractor"&gt;
                      &lt;bean
                          class="org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor"&gt;
                          &lt;property name="names" value="id,name" /&gt;
                      &lt;/bean&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  
  
      Feb 20, 2015 3:22:29 PM org.springframework.batch.core.launch.support.SimpleJobLauncher run
      INFO: Job: [FlowJob: [name=partitionJdbcJob]] completed with the following parameters: [{}] and the following status: [FAILED]
      Feb 20, 2015 3:22:29 PM org.springframework.context.support.ClassPathXmlApplicationContext doClose
      INFO: Closing org.springframework.context.support.ClassPathXmlApplicationContext
      @d37d44: startup date [Fri Feb 20 15:22:27 IST 2015]; root of context hierarchy
  </code></pre>