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

Rescribet

01/05/2022, 8:47 AM
Previously I built ktor docker images by using the installDist task, but after switching to multiplatform the
lib/<projectname>-<version>.jar
file has disappeared and running fails with an error:
Exception in thread "main" java.lang.IllegalArgumentException: Neither port nor sslPort specified. Use command line options -port/-sslPort or configure connectors in application.conf
I’ve tried reproducing by using the (CIO) ‘full stack web application’ project generator which basically fails with the same error, since it doesn’t use HOCON:
Caused by: java.lang.ClassNotFoundException: com.test.fullstack.application.ServerKt
b

Big Chungus

01/05/2022, 8:53 AM
Do you use withJava() dsl on your jvm target?
It's needed for java plugin interop
r

Rescribet

01/05/2022, 8:54 AM
Yes, a
withJava()
call is present in both projects under
kotin { jvm {
b

Big Chungus

01/05/2022, 8:55 AM
Is application.conf present in your resources?
r

Rescribet

01/05/2022, 8:56 AM
In the jvmMain resources, the repro is freshly generated and uses
embeddedServer
b

Big Chungus

01/05/2022, 8:57 AM
Which ktor version are you on?
r

Rescribet

01/05/2022, 8:58 AM
2.0.0-beta1
and
1.6.3
, with gradles 7+ and kotlin
1.6.10
b

Big Chungus

01/05/2022, 8:59 AM
Can you share your build.gradle.kts?
r

Rescribet

01/05/2022, 9:03 AM
b

Big Chungus

01/05/2022, 9:07 AM
I can't remember why, but I think I couldn't get it to work with mpp as well. Ended up switching to fat jar instead https://github.com/mpetuska/kamp/blob/master/app/build.gradle.kts
1
r

Rescribet

01/05/2022, 9:21 AM
Ah, I somewhat suspected such a thing. Thank you, I’ll give that a try
b

Big Chungus

01/05/2022, 9:24 AM
I guess it only works with kotlin jvm plugin
r

Rescribet

01/06/2022, 9:56 AM
@Big Chungus Deployed to staging today. You’re a hero 👍
b

Big Chungus

01/06/2022, 9:59 AM
Exciting!
2 Views