Hi all :wave: A real noob question... I'm trying t...
# ktor
y
Hi all 👋 A real noob question... I'm trying to run now the fat jar of my app from the command line after running
./gradlew build
and I'm getting the following error:
Copy code
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! 🙏
1
h
How does your conf file look like?
y
Copy code
ktor {
  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"
  }
}
a
To make it work, remove the
ktor_server_config_yaml
dependency. This dependency forces Ktor to load the
application.yaml
configuration file instead of
application.conf
.
mind blown 1
y
Thanks @Aleksei Tirman [JB]! I've added this at the beginning as I didn't know ktor comes with a
.conf
setup and forgot about it 🤦‍♂️