NoClassDefFoundError on PfiStructureTest
NoClassDefFoundError on PfiStructureTest PR 🧵
8 Replies
@chrisgiglio I'm still working through this for you. It's delayed because it's not simple and I'm looking at why.
You're getting:
OK, fine, so this signals to me that some other dependency is referencing the class
io.ktor.server.plugins.contentnegotiation.ContentNegotiationKt
and not finding it on the --classpath
But your test has --classpath
where I clearly see:
/Users/alr/.m2/repository/io/ktor/ktor-client-content-negotiation-jvm/2.3.7/ktor-client-content-negotiation-jvm-2.3.7.jar
And in that JAR:
OHHHHH, wrong package - it's in io.ktor.server.plugins
not io.ktor.client.plugins
, one sec
This is why I write shit out BTW, it forces thought.
@chrisgiglio I have a short window to turn this around for you - sent huddle
OK, I've issued a couple commits into the pfi-structure-test
branch to unblock Chris.
Found the underlying issue too. It's not about version mismatch; it's because tbdex-server
doesn't export out the dependency io.ktor:ktor-server-content-negotiation-jvm
required to run TbdexHttpServer.start()
.
@jiyoontbd @frankhinek - is that correct? Shouldn't consumers get ktor-server-content-negotiation-jvm
on their runtime --classpath
when they depend on tbdex-server
?
Here are my recommended text steps for @chrisgiglio:
https://github.com/TBD54566975/developer.tbd.website/pull/1290/commits/cb1bc3c7efeb1b7f470487bfd960f0e36229d2f0
My note 1) there may be a little outdated; it looks from the tbdex-kt
team that they don't intend for devs to directly run TbdexHttpServer.start()
, but rather wrap it in a ktor TestApplication
. Example of how they do test setup is here:
https://github.com/TBD54566975/tbdex-kt/blob/main/httpserver/src/test/kotlin/ServerTest.kt
Note that this is lifecycle setup for starting the server on each test class. The test itself should be issuing requests to the server and checking the responses, running assertions on them.
What's weird @jiyoontbd is I'm expecting this to be exported, and it's not?
https://github.com/TBD54566975/tbdex-kt/blob/main/httpserver/build.gradle.kts#L62
Maybe because the Dev Site isn't on an updated version of tbDEX?
AHA I see why; it's because:
https://github.com/TBD54566975/tbdex-kt/blob/main/gradle/libs.versions.toml#L44
We have io.ktor:ktor-server-content-negotiation
and it needs to be io.ktor:ktor-server-content-negotiation-jvm
I'll make a PR.Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
Well, without
ktor-server-content-negotiation-jvm
we got:
So something in there is expecting it to be there
If you look inside ktor-server-content-negotiation-jvm
you see classes. Inside ktor-server-content-negotiation
: no classes. So that makes sense.
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
Right. The JVM one does
I’ll have to look more later, but you got us good direction on its intended use so I can make PRs to fix stuff up.
You see things inside tbdex a little differently because that’s the project you’re working in, not importing. 🙂 Internal testsuites can lie for that reason, which is why @chrisgiglio work is so great as an external acceptance suite to catch things
Yeah it’s totally cool to call it @techgirl1908 but it’s a blocking operation - so the intended use is to wrap it in TestApplication so that the server will boot in another thread while returning the calling stack to continue. Totally cool to call this API; you would just need to set up your own threading so the test doesn’t hang sitting in that “start” line
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
Hard agree
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View