Ktor does not detect my application.conf file
See original GitHub issuebuild.gradle file:
group 'Example'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.1.51'
ext.ktor_version = '0.9.0'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
mainClassName = 'com.WebAppKt'
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
kotlin {
experimental {
coroutines "enable"
}
}
repositories {
mavenCentral()
maven { url "https://dl.bintray.com/kotlin/kotlinx" }
maven { url "https://dl.bintray.com/kotlin/ktor" }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile "io.ktor:ktor-server-jetty:$ktor_version"
compile "ch.qos.logback:logback-classic:1.2.1"
}
File structure:
application.conf:
ktor {
deployment {
port = 9000
watch = [ com ]
}
application {
modules = [ com.WebAppKt.main ]
}
}
The log:
7:47:45 PM: Executing task 'run'...
:compileKotlin UP-TO-DATE
:compileJava NO-SOURCE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
19:47:47.236 [main] DEBUG org.eclipse.jetty.util.log - Logging to Logger[org.eclipse.jetty.util.log] via org.eclipse.jetty.util.log.Slf4jLog
19:47:47.253 [main] INFO org.eclipse.jetty.util.log - Logging initialized @502ms to org.eclipse.jetty.util.log.Slf4jLog
19:47:47.264 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@19bb089b added {qtp897913732{STOPPED,8<=0<=200,i=0,q=0},AUTO}
19:47:47.286 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - HttpConnectionFactory@36d64342[HTTP/1.1] added {HttpConfiguration@39ba5a14{32768/8192,8192/8192,https://:0,[]},POJO}
19:47:47.376 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - HTTP2CServerConnectionFactory@735b5592[h2c] added {HttpConfiguration@39ba5a14{32768/8192,8192/8192,https://:0,[]},POJO}
19:47:47.388 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{null,[]}{0.0.0.0:0} added {org.eclipse.jetty.server.Server@19bb089b,UNMANAGED}
19:47:47.389 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{null,[]}{0.0.0.0:0} added {qtp897913732{STOPPED,8<=0<=200,i=0,q=0},AUTO}
19:47:47.390 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{null,[]}{0.0.0.0:0} added {org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@475530b9,AUTO}
19:47:47.390 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{null,[]}{0.0.0.0:0} added {org.eclipse.jetty.io.ArrayByteBufferPool@59fa1d9b,POJO}
19:47:47.391 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{null,[http/1.1]}{0.0.0.0:0} added {HttpConnectionFactory@36d64342[HTTP/1.1],AUTO}
19:47:47.392 [main] DEBUG org.eclipse.jetty.server.AbstractConnector - ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:0} added HttpConnectionFactory@36d64342[HTTP/1.1]
19:47:47.392 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:0} added {HTTP2CServerConnectionFactory@735b5592[h2c],AUTO}
19:47:47.393 [main] DEBUG org.eclipse.jetty.server.AbstractConnector - ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:0} added HTTP2CServerConnectionFactory@735b5592[h2c]
19:47:47.398 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:0} added {org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@523884b2,MANAGED}
19:47:47.399 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@19bb089b added {ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080},AUTO}
19:47:47.416 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@19bb089b added {io.ktor.server.jetty.JettyKtorHandler@464bee09,MANAGED}
19:47:47.416 [main] INFO ktor.application - No ktor.deployment.watch patterns specified, automatic reload is not active
19:47:47.461 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting org.eclipse.jetty.server.Server@19bb089b
19:47:47.463 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@19bb089b added {org.eclipse.jetty.server.handler.ErrorHandler@6c3708b3,AUTO}
19:47:47.465 [main] INFO org.eclipse.jetty.server.Server - jetty-9.4.6.v20170531
19:47:47.485 [main] DEBUG org.eclipse.jetty.server.handler.AbstractHandler - starting org.eclipse.jetty.server.Server@19bb089b
19:47:47.485 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting qtp897913732{STOPPED,8<=0<=200,i=0,q=0}
19:47:47.487 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @739ms qtp897913732{STARTED,8<=8<=200,i=1,q=0}
19:47:47.487 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting io.ktor.server.jetty.JettyKtorHandler@464bee09
19:47:47.487 [main] DEBUG org.eclipse.jetty.server.handler.AbstractHandler - starting io.ktor.server.jetty.JettyKtorHandler@464bee09
19:47:47.488 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @740ms io.ktor.server.jetty.JettyKtorHandler@464bee09
19:47:47.488 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting org.eclipse.jetty.server.handler.ErrorHandler@6c3708b3
19:47:47.488 [main] DEBUG org.eclipse.jetty.server.handler.AbstractHandler - starting org.eclipse.jetty.server.handler.ErrorHandler@6c3708b3
19:47:47.488 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @741ms org.eclipse.jetty.server.handler.ErrorHandler@6c3708b3
19:47:47.489 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080}
19:47:47.506 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080} added {sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:8080],POJO}
19:47:47.508 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@475530b9
19:47:47.509 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @761ms org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@475530b9
19:47:47.509 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting HttpConnectionFactory@36d64342[HTTP/1.1]
19:47:47.510 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @762ms HttpConnectionFactory@36d64342[HTTP/1.1]
19:47:47.510 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting HTTP2CServerConnectionFactory@735b5592[h2c]
19:47:47.511 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @763ms HTTP2CServerConnectionFactory@735b5592[h2c]
19:47:47.512 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@523884b2
19:47:47.537 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.io.ManagedSelector@22a67b4 id=0 keys=-1 selected=-1 added {EatWhatYouKill@57855c9a/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@3b084709/IDLE/0/1,AUTO}
19:47:47.538 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@523884b2 added {org.eclipse.jetty.io.ManagedSelector@22a67b4 id=0 keys=-1 selected=-1,AUTO}
19:47:47.539 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.io.ManagedSelector@3224f60b id=1 keys=-1 selected=-1 added {EatWhatYouKill@63e2203c/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@1efed156/IDLE/0/1,AUTO}
19:47:47.541 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@523884b2 added {org.eclipse.jetty.io.ManagedSelector@3224f60b id=1 keys=-1 selected=-1,AUTO}
19:47:47.541 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting org.eclipse.jetty.io.ManagedSelector@22a67b4 id=0 keys=-1 selected=-1
19:47:47.542 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting EatWhatYouKill@57855c9a/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@3b084709/IDLE/0/1
19:47:47.542 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @794ms EatWhatYouKill@57855c9a/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@3b084709/IDLE/0/1
19:47:47.686 [main] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool - queue org.eclipse.jetty.io.ManagedSelector$$Lambda$4/513169028@4d95d2a2
19:47:47.693 [qtp897913732-10] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool - run org.eclipse.jetty.io.ManagedSelector$$Lambda$4/513169028@4d95d2a2
19:47:47.696 [qtp897913732-10] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@57855c9a/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@3b084709/PRODUCING/0/1 execute true
19:47:47.698 [qtp897913732-10] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@57855c9a/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@3b084709/PRODUCING/0/1 produce non-blocking
19:47:47.698 [qtp897913732-10] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector loop waiting on select
19:47:47.701 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @953ms org.eclipse.jetty.io.ManagedSelector@22a67b4 id=0 keys=0 selected=0
19:47:47.703 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting org.eclipse.jetty.io.ManagedSelector@3224f60b id=1 keys=-1 selected=-1
19:47:47.703 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - starting EatWhatYouKill@63e2203c/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@1efed156/IDLE/0/1
19:47:47.703 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @956ms EatWhatYouKill@63e2203c/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@1efed156/IDLE/0/1
19:47:47.705 [main] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool - queue org.eclipse.jetty.io.ManagedSelector$$Lambda$4/513169028@53f65459
19:47:47.705 [qtp897913732-11] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool - run org.eclipse.jetty.io.ManagedSelector$$Lambda$4/513169028@53f65459
19:47:47.705 [qtp897913732-11] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@63e2203c/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@1efed156/PRODUCING/0/1 execute true
19:47:47.705 [qtp897913732-11] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@63e2203c/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@1efed156/PRODUCING/0/1 produce non-blocking
19:47:47.705 [qtp897913732-11] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector loop waiting on select
19:47:47.706 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @958ms org.eclipse.jetty.io.ManagedSelector@3224f60b id=1 keys=0 selected=0
19:47:47.706 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @959ms org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@523884b2
19:47:47.711 [main] DEBUG org.eclipse.jetty.util.component.ContainerLifeCycle - ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080} added {acceptor-0@74650e52,POJO}
19:47:47.713 [main] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool - queue acceptor-0@74650e52
19:47:47.714 [qtp897913732-12] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool - run acceptor-0@74650e52
19:47:47.716 [main] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080}
19:47:47.717 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @969ms ServerConnector@d8355a8{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080}
19:47:47.717 [main] INFO org.eclipse.jetty.server.Server - Started @970ms
19:47:47.718 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @970ms org.eclipse.jetty.server.Server@19bb089b
The server still uses the port 8080 instead of 9000 and auto-reload doesn’t work. I tried to rebuild the project many times.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Configuration | Ktor
Ktor allows you to configure various server parameters, such as a host address and port, modules to load, enable the development mode, ...
Read more >Can't read application.conf file : KTOR-3951
I'm Android Developer and currently I'm learning Backend using Ktor, but I have some problem. I want to make a JWT authentication, I...
Read more >服务器 Configuration - Ktor
Ktor provides an interface that you can implement the configuration in, available at application.environment.config . You can construct and set the ...
Read more >Ktor with Gradle run configuration "Could not resolve ...
I had to manually restart the IntelliJ (NOT via File ). Simply closed the IDE, ... Also, check that your environment variable is...
Read more >Bad experience with Ktor setup : r/Kotlin - Reddit
For example, with both IntelliJ and the ktor site config generator ... The main function you quoted is not the one in my...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this is how your main should look like when using
embeddedServer()
andapplication.conf
I see, currently you can’t have config-based application with lambda-based module. We need to think about how to make this possible.