https://kotlinlang.org logo
#ktor
Title
# ktor
t

torres

07/10/2020, 2:47 PM
any advice how to fix this error?
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
..
at io.ktor.server.netty.NettyApplicationEngine.start(NettyApplicationEngine.kt:126)
at io.ktor.server.netty.EngineMain.main(EngineMain.kt:26)
at com.example.ApplicationKt.main(Application.kt:11)
Caused by: <http://java.net|java.net>.ConnectException: Connection refused
at <http://sun.nio.ch|sun.nio.ch>.SocketChannelImpl.checkConnect(Native Method)
at <http://sun.nio.ch|sun.nio.ch>.SocketChannelImpl.finishConnect(SocketChannelImpl.java:714)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:174)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:148)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:351)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
at java.lang.Thread.run(Thread.java:821)
1
v

Viktor Petrovski

07/10/2020, 2:51 PM
What do you have in your application.conf?
t

torres

07/10/2020, 3:06 PM
Copy code
ktor {
    deployment {
        port = 8080
        port = ${?PORT}
    }
    application {
        modules = [ com.example.ApplicationKt.module ]
    }
}
@Viktor Petrovski
v

Viktor Petrovski

07/10/2020, 3:07 PM
Can you check if port 8080 is already taken on your machine?
t

torres

07/10/2020, 3:08 PM
i checked already and its not taken
i even changed port to anything other than 8080
does it work fine on your machine?
v

Viktor Petrovski

07/10/2020, 3:10 PM
Try removing
Copy code
@Suppress("unused") // Referenced in application.conf
@kotlin.jvm.JvmOverloads
20 Views