Unable to start a ktor server with this error. Exc...
# ktor
j
Unable to start a ktor server with this error. Exception in thread "main" io.ktor.server.engine.internal.ReloadingException: Module function cannot be found for the fully qualified name 'com.blackfox.myoutfitpicker.ApplicationKt.module' at io.ktor.server.engine.internal.CallableUtilsKt.executeModuleFunction(CallableUtils.kt:27) I am following the instructions at https://ktor.io/docs/eap/creating-http-apis.html#order_routes
Copy code
import io.ktor.server.application.*
import com.blackfox.myoutfitpicker.plugins.configureRouting
import com.blackfox.myoutfitpicker.plugins.configureSerialization

fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)

fun Application.module() {
    configureRouting()
    configureSerialization()
}
I have no idea what I am doing wrong.
s
What's in your
application.conf
? Might be the package-name there is different so it can't find the specified module perhaps?
a
And check that a source file with the
Application.module
definition is named
Application.kt
.
j
@Steffen Lien and @Aleksei Tirman [JB]
Copy code
ktor {
    deployment {
        port = 8080
        port = ${?PORT}
    }
    application {
        modules = [ com.blackfox.myoutfitpicker.ApplicationKt.module ]
    }
}
And the application source, which you can also see at https://github.com/jblack975/MyOutfitPicker
Copy code
package com.blackfox.myoutfitpicker

import io.ktor.server.application.*
import com.blackfox.myoutfitpicker.plugins.configureRouting
import com.blackfox.myoutfitpicker.plugins.configureSerialization

fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)

fun Application.module() {
    configureRouting()
    configureSerialization()
}
s
@James Black Either change the filename
Main.kt
to
Application.kt
or change the modules part in your
application.conf
to
modules = [ com.blackfox.myoutfitpicker.MainKt.module ]
. The
<File>Kt
part of the modules is looking for a specific file called exactly that as I recall (haven't tried to run your project)
j
Thanks @Steffen Lien. I didn't realize the filename was the important part here. It runs now.
👍 2
374 Views