I am using:
Also tried with 'jdk1.8.0_202.jdk/'
I follow the QuickStart from https://ktor.io/quickstart/index.html
When I run the generated code from inside IntelliJ I get:
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA 2019.1 EAP.app/Contents/lib/idea_rt.jar=50192:/Applications/IntelliJ IDEA 2019.1 EAP.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Users/NOTiFY/IdeaProjects/HelloKtorWorld/out/production/classes:/Users/NOTiFY/IdeaProjects/HelloKtorWorld/out/production/resources:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-server-netty/1.2.0/c30ea7f287343d3007a0794dbfeb3f69aad76ca8/ktor-server-netty-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-html-builder/1.2.0/53ef376dc21a1f404a5154096708fc104092ec77/ktor-html-builder-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-server-host-common/1.2.0/a4335b06f785b39d976e70a00a988bd077beacd1/ktor-server-host-common-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-server-core/1.2.0/4ba64df7deeb3b3cc81b66f005962edfaf63e554/ktor-server-core-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains/kotlin-css-jvm/1.0.0-pre.31-kotlin-1.2.41/718c1d40ec10699ee0ab086e2e9d4d1ebe95646d/kotlin-css-jvm-1.0.0-pre.31-kotlin-1.2.41.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-jetty/1.2.0/3dd4fd4541dd7c85564c65162117a2dd60933f0b/ktor-client-jetty-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-core-jvm/1.2.0/f88e71cffbb49bdba1f1e93131cdee2e2bae0eaa/ktor-client-core-jvm-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-http-cio-jvm/1.2.0/d37a4df9617f49378780554421a3744ab5ceb1d9/ktor-http-cio-jvm-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-http-jvm/1.2.0/aab3e7e34ba1c1947fe362f899d308d97622cfb8/ktor-http-jvm-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-network/1.2.0/bbaefc8c4d66d3707b0a247a341a2f3ea7bd0c5/ktor-network-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-utils-jvm/1.2.0/9d79aff946644c0f489e75f315fcb396f5b4581e/ktor-utils-jvm-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.3.31/21edc5a6b2e39bc4dc2860346fd778e27503d6cb/kotlin-stdlib-jdk8-1.3.31.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.1/706a8b8206ead3683ec639dd270d11fd948fbb0e/logback-classic-1.2.1.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-core/1.2.0/5788736ce2795078281e5eeb4523e0c81cf8d06/ktor-client-core-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.31/e652770b6416c6d85934086899ffed3eccd35813/kotlin-stdlib-jdk7-1.3.31.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.31/5a426a5ada97967ca60fba495eeaa66cfa7c9e2f/kotlin-reflect-1.3.31.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-io-jvm/0.1.8/591b0489ce565c32d4874610ef64c948e6a5c627/kotlinx-coroutines-io-jvm-0.1.8.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-io-jvm/0.1.8/595d4772d0600272bac6a2dcec2646b037285863/kotlinx-io-jvm-0.1.8.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-html-jvm/0.6.12/95dfe9d85947c8dd57c16dced385a37280166e56/kotlinx-html-jvm-0.6.12.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-jdk8/1.2.1/4d891cee198626c08ac30028afdd743558507ad9/kotlinx-coroutines-jdk8-1.2.1.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.2.1/3839faf625f4197acaeceeb6da000f011a2acb49/kotlinx-coroutines-core-1.2.1.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.31/11289d20fd95ae219333f3456072be9f081c30cc/kotlin-stdlib-1.3.31.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-http-cio/1.2.0/9dc1ab0d309da3a03b4e4435b9dc52afbc78c580/ktor-http-cio-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-http/1.2.0/c160a65dea5200650efd8db738fa157d8e7c3f8/ktor-http-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-utils/1.2.0/67edd57c63978974769e6ab6792713d9253c1db9/ktor-utils-1.2.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/atomicfu/0.12.6/2840b58706d9ef8df7c8aee2e8b6e1444d09df60/atomicfu-0.12.6.jar:/Users/NOTiFY/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/com.typesafe/config/1.3.1/2cf7a6cc79732e3bdf1647d7404279900ca63eb0/config-1.3.1.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http2/4.1.24.Final/c0c0d9d20402e4493083447052b59d5680e88b2e/netty-codec-http2-4.1.24.Final.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-alpn-openjdk8-client/9.4.15.v20190215/d46fbf9d9c37f75e621a30bf8a192fe2ade30963/jetty-alpn-openjdk8-client-9.4.15.v20190215.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.alpn/alpn-api/1.1.3.v20160715/a1bf3a937f91b4c953acd13e8c9552347adc2198/alpn-api-1.1.3.v20160715.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.1/378913dfc3c6c71e7e2a2853eff2c3e8ac27599/logback-core-1.2.1.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains/kotlin-css/1.0.0-pre.31-kotlin-1.2.41/c40316f81304348a9983ce15a53c81130b16b36a/kotlin-css-1.0.0-pre.31-kotlin-1.2.41.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-io/0.1.8/ab4c5ab04fe13e78ab0d55d71909b22b6f52f658/kotlinx-coroutines-io-0.1.8.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.2.1/5806e3dd5e8dff59fec96747795353f3ba2bfd60/kotlinx-coroutines-core-common-1.2.1.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-io/0.1.8/59bcca58d0dae17790c96a775664267ff8492356/kotlinx-io-0.1.8.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.31/20c34a04ea25cb1ef0139598bd67c764562cb170/kotlin-stdlib-common-1.3.31.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.http2/http2-client/9.4.15.v20190215/dea5744484dbb7e192b6eb061e46d3e53a7edd95/http2-client-9.4.15.v20190215.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-alpn-java-client/9.4.15.v20190215/9e513ee27c5ea1fa4d97186e46f613b44e3a7795/jetty-alpn-java-client-9.4.15.v20190215.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/atomicfu-common/0.12.3/b09ed1e1b1a0996e0a3b6c454797d44788a21747/atomicfu-common-0.12.3.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.24.Final/8f20009953b2c7c3d860cef928007bc01aa58ac/netty-codec-http-4.1.24.Final.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.24.Final/bad56e7da211c5ebe031ae155cb648b1065c7bb6/netty-handler-4.1.24.Final.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.http2/http2-common/9.4.15.v20190215/8983928afb3064fe41b449cabcb827c1024dfba/http2-common-9.4.15.v20190215.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-alpn-client/9.4.15.v20190215/1b215197407fdf8582711e32b187ce458c6097d9/jetty-alpn-client-9.4.15.v20190215.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec/4.1.24.Final/290857e5103956bbda11836e33245f2439226b77/netty-codec-4.1.24.Final.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.24.Final/d37292c94d3a4cba48d9b6cfb6e8e55282035d0d/netty-transport-4.1.24.Final.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.24.Final/e354bed2e60b568307138e403f55ba241c1c16d2/netty-buffer-4.1.24.Final.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.http2/http2-hpack/9.4.15.v20190215/1a2b990e51ea38fb742f7cdec24064c32596edb8/http2-hpack-9.4.15.v20190215.jar:/Users/NOTiFY/.m2/repository/org/eclipse/jetty/jetty-http/9.4.15.v20190215/jetty-http-9.4.15.v20190215.jar:/Users/NOTiFY/.m2/repository/org/eclipse/jetty/jetty-io/9.4.15.v20190215/jetty-io-9.4.15.v20190215.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver/4.1.24.Final/dbc1e5b50d31aed883ea3beeb6489e1977d0687f/netty-resolver-4.1.24.Final.jar:/Users/NOTiFY/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.24.Final/7eeecd7906543214c3c1c984d275d3c6de10b99d/netty-common-4.1.24.Final.jar:/Users/NOTiFY/.m2/repository/org/eclipse/jetty/jetty-util/9.4.15.v20190215/jetty-util-9.4.15.v20190215.jar com.example.ApplicationKt
2019-05-22 08:08:07.394 [main] TRACE Application - {
# application.conf @ file:/Users/NOTiFY/IdeaProjects/HelloKtorWorld/out/production/resources/application.conf: 6
"application" : {
# application.conf @ file:/Users/NOTiFY/IdeaProjects/HelloKtorWorld/out/production/resources/application.conf: 7
"modules" : [
# application.conf @ file:/Users/NOTiFY/IdeaProjects/HelloKtorWorld/out/production/resources/application.conf: 7
"com.example.ApplicationKt.module"
]
},
# application.conf @ file:/Users/NOTiFY/IdeaProjects/HelloKtorWorld/out/production/resources/application.conf: 2
"deployment" : {
# application.conf @ file:/Users/NOTiFY/IdeaProjects/HelloKtorWorld/out/production/resources/application.conf: 3
"port" : 8080
},
# Content hidden
"security" : "***"
}
2019-05-22 08:08:07.885 [main] INFO Application - No ktor.deployment.watch patterns specified, automatic reload is not active
Exception in thread "main" java.lang.ClassNotFoundException: Module function cannot be found for the fully qualified name 'com.example.ApplicationKt.module'
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.executeModuleFunction(ApplicationEngineEnvironmentReloading.kt:367)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.access$executeModuleFunction(ApplicationEngineEnvironmentReloading.kt:33)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1$$special$$inlined$forEach$lambda$1.invoke(ApplicationEngineEnvironmentReloading.kt:287)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1$$special$$inlined$forEach$lambda$1.invoke(ApplicationEngineEnvironmentReloading.kt:33)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.avoidingDoubleStartupFor(ApplicationEngineEnvironmentReloading.kt:320)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.access$avoidingDoubleStartupFor(ApplicationEngineEnvironmentReloading.kt:33)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1.invoke(ApplicationEngineEnvironmentReloading.kt:286)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1.invoke(ApplicationEngineEnvironmentReloading.kt:33)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.avoidingDoubleStartup(ApplicationEngineEnvironmentReloading.kt:302)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.instantiateAndConfigureApplication(ApplicationEngineEnvironmentReloading.kt:284)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.createApplication(ApplicationEngineEnvironmentReloading.kt:137)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.start(ApplicationEngineEnvironmentReloading.kt:257)
at io.ktor.server.netty.NettyApplicationEngine.start(NettyApplicationEngine.kt:116)
at io.ktor.server.netty.NettyApplicationEngine.start(NettyApplicationEngine.kt:22)
at io.ktor.server.engine.ApplicationEngine$DefaultImpls.start$default(ApplicationEngine.kt:56)
at io.ktor.server.netty.EngineMain.main(EngineMain.kt:21)
at com.example.ApplicationKt.main(Application.kt:14)
Process finished with exit code 1
Any suggestions, besides look at your stack trace it's a:
java.lang.ClassNotFoundException: Module function cannot be found for the fully qualified name 'com.example.ApplicationKt.module'
?
Create a new Ktor projectOn the Welcome screen, click New Project. Otherwise, from the main menu, select File | New | Project. In the New Project wizard, choose Ktor from the list on the left. Name: Specify a project name.
CIO is a fully asynchronous coroutine-based engine that can be used on JVM, Android, and Native platforms. It supports only HTTP/1.x for now. To use it, follow the steps below: Add the ktor-client-cio dependency: implementation("io.ktor:ktor-client-cio:$ktor_version")
Ktor is a client-server framework that helps us build applications in Kotlin. It is a modern asynchronous framework backed by Kotlin coroutines. Ktor can be compared to network library such as OkHttp and Retrofit. We can use Ktor to make HTTP network requests to an API to get the response back to an application.
I ran into same issue. Above mentioned suggestion of changing flag value or deleting file, didn't worked for me.
Root cause of problem, observed in application.conf
Before
modules = [ ApplicationKt.module ]
After
modules = [ com.exp.ApplicationKt.module ]
The full path of Applicationkt.module was changed while relocating files in process of structuring classes by movement[in my case].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With