I’m having trouble getting the remote jvm debugger...
# ktor
t
I’m having trouble getting the remote jvm debugger to attach to my ktor application. The application runs in a docker container, via
installDist
as per the documentation. Running on openjdk 11 JVM args are :
Copy code
applicationDefaultJvmArgs = listOf(
    "-Dio.ktor.development=true",
    "-Dagentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8081"
)
I’ve exposed the port 8081.
At this point I think I’ve tried just about everything, but I get
Unable to open debugger port (localhost:8081): java.net.ConnectException “Connection refused (Connection refused)”
Any suggestions?
Is it possible that there’s some ‘debug’ flag required?
c
i would try debugging with just a simple hello world java app first
with the debugging flags that you are setting it should just work and its not really ktor specific
t
OK, that’s a good idea
The issue was the leading
D
in the jvm args
Copy code
"-Dagentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8081"
Should be
Copy code
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8081"
c
ah right. that makes it almost a no-op
t
But the first flag
Copy code
-Dio.ktor.development=true
Does require the ‘D’
🤯 1
Copy code
applicationDefaultJvmArgs = listOf(
    "-Dio.ktor.development=true",
    "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8081"
)
c
yeah -D just sets an env variable. you can put anything there and will never get an error
t
Ohhh! Thanks, I’ve not understood the purpose of ‘D’ in jvm flags for about 10 years
Thanks so much. This has been causing me pain all day haha
👍 1