2

When trying to start a Spring Boot application for tests (with H2 database) with R2DBC and Liquibase configured, I get the following error:

2022-10-04 12:50:18.893  INFO 57774 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 67 ms. Found 2 R2DBC repository interfaces.
org.h2.message.DbException: Log file error: "/.testdb.trace.db", cause: "java.nio.file.FileSystemException: /.testdb.trace.db: Read-only file system" [90034-214]

Here's my config:

spring:
  liquibase:
    change-log: classpath:liquibase/db.changelog.xml
    contexts: production
    url: jdbc:h2:file:///./.testdb;MODE=MySQL
    
  r2dbc:
    url: r2dbc:h2:file:///./.testdb

  h2:
    console:
      enabled: false

Is there anything I can do to fix that error?

eeqk
  • 3,492
  • 1
  • 15
  • 22

1 Answers1

0

The problem was caused by the URL, R2DBC requires it to look like this:

  r2dbc:
    url: r2dbc:h2:file:///./.testdb

But then if you try to copy it over to Liquibase part, the error appears. To fix that, remove forward slashes from Liquibase URL:

spring:
  liquibase:
    change-log: classpath:liquibase/db.changelog.xml
    contexts: production
    url: jdbc:h2:file:./.testdb;MODE=MySQL

Final version:

spring:
  liquibase:
    change-log: classpath:liquibase/db.changelog.xml
    contexts: production
    url: jdbc:h2:file:./.testdb;MODE=MySQL

  r2dbc:
    url: r2dbc:h2:file:///./.testdb
  h2:
    console:
      enabled: false
eeqk
  • 3,492
  • 1
  • 15
  • 22