Yonatan Karp-Rudin
06/15/2024, 7:16 PM./gradlew build
and I'm getting the following error:
Exception in thread "main" java.lang.IllegalArgumentException: Neither port nor sslPort specified. Use command line options -port/-sslPort or configure connectors in application.conf
at io.ktor.server.engine.CommandLineKt$buildCommandLineEnvironment$environment$1.invoke(CommandLine.kt:78)
at io.ktor.server.engine.CommandLineKt$buildCommandLineEnvironment$environment$1.invoke(CommandLine.kt:39)
at io.ktor.server.engine.ApplicationEngineEnvironmentBuilder.build(ApplicationEngineEnvironmentJvm.kt:74)
at io.ktor.server.engine.ApplicationEngineEnvironmentKt.applicationEngineEnvironment(ApplicationEngineEnvironment.kt:48)
at io.ktor.server.engine.CommandLineKt.buildCommandLineEnvironment(CommandLine.kt:39)
at io.ktor.server.engine.CommandLineKt.commandLineEnvironment(CommandLine.kt:98)
at io.ktor.server.netty.EngineMain.main(EngineMain.kt:20)
I've seen that many people complain about this online but couldn't find any solution.
My application.conf
is located under the resources
dir as it was configured automatically by the ktor wiz 🙈
To run the app I'm execution simply java -jar ./build/libs/myapp-all.jar
All source code is available here.
Thanks in advance! 🙏hfhbd
06/15/2024, 7:33 PMYonatan Karp-Rudin
06/15/2024, 7:44 PMktor {
application {
modules = [ "com.xkcddatahub.fetcher.bootstrap.ApplicationKt.module" ]
}
deployment {
port = 8090
}
database {
url = "jdbc:<postgresql://localhost:5432/xkcd_data_hub>"
driver = "org.postgresql.Driver"
user = "postgres"
password = "secret"
}
}
Aleksei Tirman [JB]
06/17/2024, 8:01 AMktor_server_config_yaml
dependency. This dependency forces Ktor to load the application.yaml
configuration file instead of application.conf
.Yonatan Karp-Rudin
06/17/2024, 10:08 AM.conf
setup and forgot about it 🤦♂️