Ktor: Ktor starter application throw errors on start

Created on 15 Apr 2019  路  4Comments  路  Source: ktorio/ktor

Ktor Version

1.1.3

Ktor Engine Used(client or server and name)

default Http client

JVM Version, Operating System and Relevant Context

OS: MacOS
JVM: Java 10
Gradle: Gradle wrapper bundled with Ktor starter
Ktor Starter Options: https://start.ktor.io/#dependency=ktor-client-core&dependency=ktor-jackson&dependency=cors&dependency=routing&dependency=content-negotiation&project-type=gradle-kotlin-dsl

Feedback

I went over to start.ktor.io to try out ktor, selected the options listed above, downloaded the project, ran ./gradlew build && ./gradlew run and I encountered this error:

"Caused by: java.lang.IllegalStateException: Failed to find HTTP client engine implementation in the classpath: consider adding client engine dependency."

I looked around at the link provided in the error, but I was under the impression that ktor had a default http engine.

documentation

Most helpful comment

Just in case anyone else hits this page for the same reasons I did, I was seeing the above error since upgrading to 1.4.0.
It looks like the package names for the http client implementations have now changed, and -jvm has been added, so the gradle file has to be edited accordingly.

All 4 comments

Hi, @dedward3. Thanks for the report.

To use ktor-client, you should select one of the client engines to perform the request. Here you could find additional details: https://ktor.io/clients/http-client/engines.html

Could you try to generate a project with one of client engines or add it to dependency section of your build.gradle file?

hey @e5l,

When I added the CIO engine everything booted up just fine. So I'm guessing that HttpClient engine is just the core and the options below it are implementations of it?

Yes, and we can use different engines depending on the platform.

Closed.

Just in case anyone else hits this page for the same reasons I did, I was seeing the above error since upgrading to 1.4.0.
It looks like the package names for the http client implementations have now changed, and -jvm has been added, so the gradle file has to be edited accordingly.

Was this page helpful?
0 / 5 - 0 ratings