Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table "BATCH_JOB_INSTANCE" not found: org.h2.jdbc.JdbcSQLException

I am trying to run my application using the embedded h2 db.

I get the following error:

Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?]; nested exception is org.h2.jdbc.JdbcSQLException: Table "BATCH_JOB_INSTANCE" not found; SQL statement:
SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ? [42102-197]

I've already tried:

  1. Deleting the h2 repository from the .m2 local folder and re-import and re-install - unsuccessfully.
  2. I also tried configuring the properties file with the following:

spring.datasource.driverClassName=org.h2.Driver

spring.datasource.url=jdbc:h2:mem:testdb

spring.jpa.hibernate.ddl-auto=create

spring.jpa.show-sql=true

spring.h2.console.enabled=true

Any suggestions?

Thanks!

like image 209
JustDeveloper Avatar asked Mar 26 '26 01:03

JustDeveloper


1 Answers

I found a solution:

I had a circular dependency while I was trying to select the JOB-INSTANCE in an early stage before the embedded DB was configured.

Changing the bean instantiation order fixed it.

like image 178
JustDeveloper Avatar answered Mar 27 '26 18:03

JustDeveloper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!