![](/img/trans.png)
[英]Setup h2 in spring boot application with r2dbc and flyway
[英]Spring, H2, R2DBC and Liquibase: /.testdb.trace.db: Read-only file system
當嘗試啟動 Spring 引導應用程序進行測試(使用 H2 數據庫)並配置 R2DBC 和 Liquibase 時,出現以下錯誤:
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]
這是我的配置:
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
我能做些什么來修復這個錯誤嗎?
問題是由 URL 引起的,R2DBC 要求它看起來像這樣:
r2dbc:
url: r2dbc:h2:file:///./.testdb
但是,如果您嘗試將其復制到 Liquibase 部分,則會出現錯誤。 要解決此問題,請從 Liquibase URL 中刪除正斜杠:
spring:
liquibase:
change-log: classpath:liquibase/db.changelog.xml
contexts: production
url: jdbc:h2:file:./.testdb;MODE=MySQL
最終版本:
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.