klibnotion icon indicating copy to clipboard operation
klibnotion copied to clipboard

Caused by: java.lang.ClassNotFoundException: io.ktor.client.features.json.JsonFeature at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)

Open Bjaux opened this issue 2 years ago • 4 comments

Hey!

I really like the API of your project and since I want to use it for my own ktor server project (where my server should act as a middleware between other clients and multiple services, including notion).

I sadly am not able to get it to start. When I try to make calls with your client I get always ClassNotFoundExceptions like the one above or before I got ClassNotFound io.ktor.client.features.HttpClientFeature. It switched over to the JSON-Feature when I added one by one those additional dependencies:

    //debugging
    implementation("io.ktor", "ktor-client-okhttp", ktor_version)
    implementation("io.ktor:ktor-client-core:$ktor_version")
    implementation("io.ktor:ktor-client-cio:$ktor_version")
    implementation("io.ktor:ktor-client-logging:$ktor_version")
    implementation("io.ktor:ktor-client-content-negotiation:$ktor_version")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
    implementation("io.ktor:ktor-serialization-kotlinx-xml:$ktor_version")
    implementation("io.ktor:ktor-serialization-kotlinx-cbor:$ktor_version")
    implementation("io.ktor:ktor-client-auth:$ktor_version")
    implementation("io.ktor", "ktor-client-json", ktor_version)
    implementation("io.ktor", "ktor-client-serialization", ktor_version)
    implementation("io.ktor", "ktor-client-logging", ktor_version)
    implementation("org.apache.httpcomponents:httpclient:4.5.13")

I myself am using the Version 2.0.0 of ktor server and 1.6.20 of kotlin.

I very much hope you can help, there are 1-2 other options out there but like I said your api is great, especially your Content DSL.

Best Regards, Björn

Bjaux avatar Apr 13 '22 21:04 Bjaux

Hi! Thanks for reporting this. Just after a quick look, I am guessing this may be due to using KTOR 2 whereas this lib uses the 1.x version, maybe using both in the same project is not supported (if I remember correctly they have moved / renamed some classes, etc.).

Now that v2 is stable, I should update the lib to use it! I'll give it a look although I must warn that I'll be unavailable for the next days so it will probably be next week or so. I don't know if that's a big migration or not. If you're so Inclined, you can also take a look and maybe submit a PR 😊

BoD avatar Apr 14 '22 07:04 BoD

Hey, thanks for the very fast answer!

I probably need to get a MVP of my system running before I can invest the time, but if it's still open then I will surely check back in and take a look at it :)

All in all I plan to go a pretty clean architecture way with a BaseNotionService wrapping the client and stuff with like 4-10 databases to start with that I connect to so I'm not too worried about switching to your lib later on if the problem is resolved. But I see a lot of maintainability and extensibility using your approach.

Great work so far again and thanks for sharing it in the first place (:

Bjaux avatar Apr 15 '22 12:04 Bjaux

Any plans when you can look into the problem? I'm also having problems using the library in combination with ktor 2.0

MaaxGr avatar Feb 12 '23 16:02 MaaxGr

https://github.com/BoD/klibnotion/pull/40 @BoD and anyone interested, please take a look

KazankovMarch avatar Sep 01 '23 15:09 KazankovMarch