JDBC_DATABASE_URL错误,无法在Heroku上部署ktor应用。

问题描述 投票:0回答:1

我试图将ktor rest-API部署到heroku,heroku生成了一个DATABASE_URL,但当我尝试运行时,它给出了这个错误,说 jdbcUrl是需要和driverClassName一起使用的。

State changed from crashed to starting
2020-05-13T14:01:34.459797+00:00 app[web.1]: 2020-05-13 14:01:34.457 [main] TRACE Application - {
2020-05-13T14:01:34.459822+00:00 app[web.1]: # application.conf @ jar:file:/app/scienta-0.0.1.jar!/application.conf: 7
2020-05-13T14:01:34.459823+00:00 app[web.1]: "application" : {
2020-05-13T14:01:34.459823+00:00 app[web.1]: # application.conf @ jar:file:/app/scienta-0.0.1.jar!/application.conf: 8
2020-05-13T14:01:34.459823+00:00 app[web.1]: "modules" : [
2020-05-13T14:01:34.459824+00:00 app[web.1]: # application.conf @ jar:file:/app/scienta-0.0.1.jar!/application.conf: 8
2020-05-13T14:01:34.459824+00:00 app[web.1]: "co.scienta.ridesharecompare.ApplicationKt.module"
2020-05-13T14:01:34.459825+00:00 app[web.1]: ]
2020-05-13T14:01:34.459825+00:00 app[web.1]: },
2020-05-13T14:01:34.459826+00:00 app[web.1]: # application.conf @ jar:file:/app/scienta-0.0.1.jar!/application.conf: 2
2020-05-13T14:01:34.459826+00:00 app[web.1]: "deployment" : {
2020-05-13T14:01:34.459826+00:00 app[web.1]: # application.conf @ jar:file:/app/scienta-0.0.1.jar!/application.conf: 5
2020-05-13T14:01:34.459827+00:00 app[web.1]: "host" : "0.0.0.0",
2020-05-13T14:01:34.459827+00:00 app[web.1]: # env var PORT
2020-05-13T14:01:34.459827+00:00 app[web.1]: "port" : "52703"
2020-05-13T14:01:34.459827+00:00 app[web.1]: },
2020-05-13T14:01:34.459828+00:00 app[web.1]: # Content hidden
2020-05-13T14:01:34.459828+00:00 app[web.1]: "security" : "***"
2020-05-13T14:01:34.459828+00:00 app[web.1]: }
2020-05-13T14:01:34.459829+00:00 app[web.1]:
2020-05-13T14:01:34.681389+00:00 app[web.1]: 2020-05-13 14:01:34.680 [main] INFO  Application - No ktor.deployment.watch patterns specified, automatic reload is not active
2020-05-13T14:01:35.287566+00:00 app[web.1]: 2020-05-13 14:01:35.285 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class org.postgresql.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@70dea4e
2020-05-13T14:01:35.298702+00:00 app[web.1]: 2020-05-13 14:01:35.298 [main] ERROR com.zaxxer.hikari.HikariConfig - HikariPool-1 - jdbcUrl is required with driverClassName.
2020-05-13T14:01:35.299261+00:00 app[web.1]: Exception in thread "main" java.lang.reflect.InvocationTargetException
2020-05-13T14:01:35.299475+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-05-13T14:01:35.299539+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2020-05-13T14:01:35.299588+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2020-05-13T14:01:35.299629+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498)
2020-05-13T14:01:35.299675+00:00 app[web.1]: at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97)
2020-05-13T14:01:35.299730+00:00 app[web.1]: at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Static.call(CallerImpl.kt:106)
2020-05-13T14:01:35.299767+00:00 app[web.1]: at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:106)
2020-05-13T14:01:35.299815+00:00 app[web.1]: at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:152)
2020-05-13T14:01:35.299866+00:00 app[web.1]: at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:110)
2020-05-13T14:01:35.299913+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.callFunctionWithInjection(ApplicationEngineEnvironmentReloading.kt:392)
2020-05-13T14:01:35.299992+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.executeModuleFunction(ApplicationEngineEnvironmentReloading.kt:340)
2020-05-13T14:01:35.300072+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.access$executeModuleFunction(ApplicationEngineEnvironmentReloading.kt:33)
2020-05-13T14:01:35.300149+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1$$special$$inlined$forEach$lambda$1.invoke(ApplicationEngineEnvironmentReloading.kt:287)
2020-05-13T14:01:35.300224+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1$$special$$inlined$forEach$lambda$1.invoke(ApplicationEngineEnvironmentReloading.kt:33)
2020-05-13T14:01:35.300302+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.avoidingDoubleStartupFor(ApplicationEngineEnvironmentReloading.kt:320)
2020-05-13T14:01:35.300382+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.access$avoidingDoubleStartupFor(ApplicationEngineEnvironmentReloading.kt:33)
2020-05-13T14:01:35.300457+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1.invoke(ApplicationEngineEnvironmentReloading.kt:286)
2020-05-13T14:01:35.300534+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1.invoke(ApplicationEngineEnvironmentReloading.kt:33)
2020-05-13T14:01:35.300608+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.avoidingDoubleStartup(ApplicationEngineEnvironmentReloading.kt:302)
2020-05-13T14:01:35.300683+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.instantiateAndConfigureApplication(ApplicationEngineEnvironmentReloading.kt:284)
2020-05-13T14:01:35.300757+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.createApplication(ApplicationEngineEnvironmentReloading.kt:137)
2020-05-13T14:01:35.300854+00:00 app[web.1]: at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.start(ApplicationEngineEnvironmentReloading.kt:257)
2020-05-13T14:01:35.300928+00:00 app[web.1]: at io.ktor.server.netty.NettyApplicationEngine.start(NettyApplicationEngine.kt:126)
2020-05-13T14:01:35.300983+00:00 app[web.1]: at io.ktor.server.netty.EngineMain.main(EngineMain.kt:26)
2020-05-13T14:01:35.301239+00:00 app[web.1]: Caused by: java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.
2020-05-13T14:01:35.301313+00:00 app[web.1]: at com.zaxxer.hikari.HikariConfig.validate(HikariConfig.java:954)
2020-05-13T14:01:35.301412+00:00 app[web.1]: at co.scienta.ridesharecompare.database.DatabaseFactory.hikari(DatabaseFactory.kt:32)
2020-05-13T14:01:35.301493+00:00 app[web.1]: at co.scienta.ridesharecompare.database.DatabaseFactory.init(DatabaseFactory.kt:14)
2020-05-13T14:01:35.301566+00:00 app[web.1]: at co.scienta.ridesharecompare.ApplicationKt.module(Application.kt:55)

有谁知道JDBC_DATABASE_URL的配置变量中应该放什么?

postgresql kotlin heroku jdbc ktor
1个回答
1
投票

你的DATABASE_URL环境变量中是否有类似jdbc:postgresql:database的内容?把同样的东西放到JDBC_DATABASE_URL中。请在ktor.io关于部署到Heroku的文档中搜索JDBC_DATABASE_URL。https:/ktor.ioserversdeployhostingheroku.html。

© www.soinside.com 2019 - 2024. All rights reserved.