-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
for: external-projectIssues that should be opened against other Spring projectsIssues that should be opened against other Spring projectstype: bug
Description
Bug description
Launching step fails with the following error:
Could not obtain sequence value; nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "BATCH_JOB_SEQ.NEXTVAL" not found; SQL statement:
select BATCH_JOB_SEQ.nextval from dual [42122-206]
org.springframework.dao.DataAccessResourceFailureException: Could not obtain sequence value; nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "BATCH_JOB_SEQ.NEXTVAL" not found; SQL statement:
select BATCH_JOB_SEQ.nextval from dual [42122-206]
at app//org.springframework.jdbc.support.incrementer.AbstractSequenceMaxValueIncrementer.getNextKey(AbstractSequenceMaxValueIncrementer.java:79)
at app//org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.nextLongValue(AbstractDataFieldMaxValueIncrementer.java:128)
at app//org.springframework.batch.core.repository.dao.JdbcJobInstanceDao.createJobInstance(JdbcJobInstanceDao.java:113)
at app//org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:148)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:564)
at app//org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at app//org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at app//org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at app//org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at app//org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at app//org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean$1.invoke(AbstractJobRepositoryFactoryBean.java:181)
at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at app//org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at app//com.sun.proxy.$Proxy163.createJobExecution(Unknown Source)
at app//org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:137)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:564)
at app//org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at app//org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at app//org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:128)
at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at app//org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at app//com.sun.proxy.$Proxy166.run(Unknown Source)
at app//org.springframework.batch.test.StepRunner.launchJob(StepRunner.java:172)
at app//org.springframework.batch.test.StepRunner.launchStep(StepRunner.java:161)
at app//org.springframework.batch.test.JobLauncherTestUtils.launchStep(JobLauncherTestUtils.java:251)
at app//org.springframework.batch.test.JobLauncherTestUtils.launchStep(JobLauncherTestUtils.java:225)
Environment
Spring Batch 4.3.3
Java 15
H2 2.0.206
Steps to reproduce
Run Spring Batch with H2 v2.x database
Expected behavior
Spring Batch works normally with H2 versions without RCE flaw (https://jfrog.com/blog/the-jndi-strikes-back-unauthenticated-rce-in-h2-database-console/)
Minimal Complete Reproducible example
Take this project as the base: https://github.com/spring-guides/gs-batch-processing/tree/main/complete
Perform the following modifications:
- Replace 'org.hsqldb:hsqldb' with 'com.h2database:h2:2.0.206' in build.gradle
- Extract
/org/springframework/batch/core/schema-postgresql.sql
from the spring-batch-core jar and put it under resources folder asschema.sql
.
Build and run the application.
P.S. Using schema-h2.sql
does not work. I assume it is a separate issue.
Metadata
Metadata
Assignees
Labels
for: external-projectIssues that should be opened against other Spring projectsIssues that should be opened against other Spring projectstype: bug