question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Task Batch Sample throws Exception With Boot 2.0.M7

See original GitHub issue
java.lang.IllegalStateException: Failed to execute CommandLineRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:792) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:773) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:760) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:328) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at io.spring.BatchJobApplication.main(BatchJobApplication.java:14) [classes/:na]
Caused by: java.lang.IllegalArgumentException: Unable to deserialize the execution context
	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:325) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:309) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:665) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:655) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:686) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:698) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:754) ~[spring-jdbc-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.getExecutionContext(JdbcExecutionContextDao.java:112) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecutionDependencies(SimpleJobExplorer.java:202) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecutions(SimpleJobExplorer.java:83) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_74]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_74]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_74]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_74]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338) ~[spring-aop-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197) ~[spring-aop-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at com.sun.proxy.$Proxy57.getJobExecutions(Unknown Source) ~[na:na]
	at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.getNextJobParameters(JobLauncherCommandLineRunner.java:142) ~[spring-boot-autoconfigure-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.execute(JobLauncherCommandLineRunner.java:211) ~[spring-boot-autoconfigure-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.executeLocalJobs(JobLauncherCommandLineRunner.java:230) ~[spring-boot-autoconfigure-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.launchJobFromProperties(JobLauncherCommandLineRunner.java:123) ~[spring-boot-autoconfigure-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.run(JobLauncherCommandLineRunner.java:117) ~[spring-boot-autoconfigure-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:789) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	... 6 common frames omitted
Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id '' as a subtype of [simple type, class java.lang.Object]: no such class found
 at [Source: (ByteArrayInputStream); line: 1, column: 11] (through reference chain: java.util.HashMap["map"])
	at com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.DeserializationContext.invalidTypeIdException(DeserializationContext.java:1615) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownTypeId(DeserializationContext.java:1186) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver._typeFromId(ClassNameIdResolver.java:51) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver.typeFromId(ClassNameIdResolver.java:42) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:156) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._deserialize(AsArrayTypeDeserializer.java:97) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer.deserializeTypedFromAny(AsArrayTypeDeserializer.java:71) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserializeWithType(UntypedObjectDeserializer.java:712) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:529) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001) ~[jackson-databind-2.9.1.jar:2.9.1]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3065) ~[jackson-databind-2.9.1.jar:2.9.1]
	at org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer.deserialize(Jackson2ExecutionContextStringSerializer.java:59) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer.deserialize(Jackson2ExecutionContextStringSerializer.java:40) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:322) ~[spring-batch-core-4.0.0.M3.jar:4.0.0.M3]
	... 35 common frames omitted

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mminellacommented, Dec 15, 2017

Is this being run against an existing database? I think this is trying to deserialize an ExecutionContext that was created by the XStream serializer using the Jackson serializer…

0reactions
ernitishkumarcommented, Oct 28, 2018

I too was having this issue. The solution was flushing the DB.

By flushing the DB the OP means that truncating the batch metadeta tables which spring batch creates when starting for the first time.

Just delete batch_execution and other batch related tables rows and it will work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

org.springframework.jdbc.BadSqlGrammarException ...
I am developing the Spring Boot Batch example. In this example I am getting the below error. Using spring-boot-starter-parent is 2.0.3.
Read more >
Spring Cloud Task Reference Guide
Single Step Batch Job Starter ... When our sample application runs, Spring Boot launches our ... Exceptions Thrown by Task Execution Listener.
Read more >
spring-projects/spring-boot - Gitter
Facing an issue with spring batch. This popped up suddenly with no change to code base. Servlet.service() for servlet [dispatcherServlet] in context with...
Read more >
Spring Boot Quartz Scheduler Example: Building an Email ...
In this article, you'll learn how to schedule Jobs in spring boot using Quartz Scheduler by building a simple Email Scheduling application.
Read more >
Apache Tomcat 9 (9.0.70) - Changelog
Update the OWB module to Apache OpenWebBeans 2.0.27. ... 65001: Fix error handling for exceptions thrown from calls to ReadListener and WriteListener ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found