这是我的码头工人组成:
db:
image: postgres
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=admin
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql11/data
- ./db/init-scripts.sql:/docker-entrypoint-initdb.d/scripts.sql
volumes:
db:
driver: local
这是我的应用程序中的配置
slick.dbs.default.profile="slick.jdbc.H2Profile$"
slick.dbs.default.db.driver="org.h2.Driver"
slick.dbs.default.db.url="jdbc:postgresql://localhost:5432/postgressslmode=require"
slick.dbs.default.db.user="postgres"
slick.dbs.default.db.password="admin"
我目前正在收到此堆栈跟踪:
[CreationException: Unable to create injector, see the following errors:
1) [Guice/ErrorInCustomProvider]: RuntimeException: Driver Driver claims to not accept jdbcUrl, jdbc:postgresql://localhost:5432/postgressslmode=require
while locating ApplicationEvolutionsProvider
at EvolutionsModule.<init>(EvolutionsModule.scala:23):
Binding(class ApplicationEvolutions to ProviderConstructionTarget(class ApplicationEvolutionsProvider) eagerly)
\_ installed by: Modules$OverrideModule -> GuiceableModuleConversions$$anon$4
while locating ApplicationEvolutions
Learn more:
https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER
1 error
======================
Full classname legend:
======================
ApplicationEvolutions: "play.api.db.evolutions.ApplicationEvolutions"
ApplicationEvolutionsProvider: "play.api.db.evolutions.ApplicationEvolutionsProvider"
Driver: "org.h2.Driver"
EvolutionsModule: "play.api.db.evolutions.EvolutionsModule"
GuiceableModuleConversions$$anon$4: "play.api.inject.guice.GuiceableModuleConversions$$anon$4"
Modules$OverrideModule: "com.google.inject.util.Modules$OverrideModule"
========================
End of classname legend:
========================
]
我一直在查看光滑的文档,但看看 url 如何与预期不匹配 - 是否有一些我缺少的特殊语法?
您正在使用 H2 数据库的驱动程序,但尝试根据 JDBC URL 连接到 PostgreSQL 数据库。
使用带有 H2 驱动程序的 H2 URL,或带有 Postgres 驱动程序的 Postgres URL。