Announcement Announcement Module
Collapse
No announcement yet.
Batch JOB_EXECUTION_CONTEXT unserialize exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch JOB_EXECUTION_CONTEXT unserialize exception

    Hi all.
    During the job execution I am adding message to job execution context
    executionContext.put("RESET", "Job manually reseted");

    And In db I see:
    JOB_EXECUTION_ID SHORT_CONTEXT SERIALIZED_CONTEXT
    10251 {"map":[{"entry":{"string":["RESET","Job manually rested"]}}]} NULL

    it seems serialized map is ok.
    But when I pull this execution context with using
    Code:
    jdbcExecutionContextDao.getExecutionContext(jobExecution)
    framework tries to unserialize the string({"map":[{"entry":{"string":["RESET","Job manually rested"]}}]}) and throwing following exception:



    Code:
    java.lang.InstantiationError: java.util.Map$Entry
    	at sun.reflect.GeneratedSerializationConstructorAccessor1.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    	at com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.newInstance(Sun14ReflectionProvider.java:75)
    	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:428)
    	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:233)
    	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.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    	at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryIntoMap(MapConverter.java:86)
    	at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:78)
    	at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:72)
    	at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:67)
    	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:1058)
    	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1042)
    	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:913)
    	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:904)
    	at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.deserialize(XStreamExecutionContextStringSerializer.java:48)
    	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:222)
    	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:215)
    	at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92)
    	at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:1)
    	at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:649)
    	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)
    	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
    	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
    	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
    	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:714)
    	at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.query(SimpleJdbcTemplate.java:204)
    	at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.query(SimpleJdbcTemplate.java:209)
    	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.getExecutionContext(JdbcExecutionContextDao.java:92)
    	at batch.BatchJobInfoProvider.resetJob(BatchJobInfoProvider.java:80)
    Why is it failing to unsrialize normal serialized string? any idea?

    thanks.
    Last edited by elbek; Mar 20th, 2013, 02:41 PM.

  • #2
    Probably related to the version of xstream / jettison you are using.

    See http://forum.springsource.org/showth...alStreamDriver

    Comment


    • #3
      I don't have jettison(do not know even what is that), is it required jar? I have latest spring batch with xstream-1.4.4.jar.

      Comment


      • #4
        Well, I downgraded to xstream-1.2.2.jar and worked.

        Thanks.

        Comment

        Working...
        X