Unit test cases fails with following org.h2.jdbc.JdbcSQLException: Connection is broken

I am following Bernd Rücker stream on Java API and unit testing BPMN models.While setting up my Spring Boot application, I am getting h2 exception

### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: Connection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-175]
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Property.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity.selectDbSchemaVersion
### The error occurred while executing a query
### Cause: org.h2.jdbc.JdbcSQLException: Connection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-175]

Test case:

@Rule
  public ProcessEngineRule rule = new ProcessEngineRule(new StandaloneProcessEngineConfiguration().buildProcessEngine());

@Test
  @Deployment(resources = {"simple.bpmn"})
  public void shouldExecuteProcess() {

    ProcessEngine processEngine= rule.getProcessEngine();

    processEngine.getRuntimeService().startProcessInstanceByKey("simple");
  }

I have tried to downgrade latest h2 version and use the one used by Bernd (1.3.175).

I have also tried to change my src/main/resources/application.properties to down below:

spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

Note that I am just trying to do testing in the repository which would not require a database schema.

Appreciate any help.

Is it because of the the tutorial uses older version while I am using camunda version 7.12?

Hey @AymanPatel,

Can you provide your pom.xml?

This shouldn’t happen with H2, but have you tried adding the org.springframework.boot:spring-boot-starter-jdbc dependency to your project?

Does the problem disappear when you do?

Best,
Nikola