<@U02AB5P2XU6> I wonder if you could possibly help...
# kobweb
r
@David Herman I wonder if you could possibly help me with something else. I'm trying to make a fullstack app, and am encountering an issue if I ever use the
@Api
annotation.
Copy code
java.lang.NoSuchMethodError: 'java.lang.Object java.util.List.removeFirst()'
  	at com.varabyte.kobweb.navigation.RouteTree.register(RouteTree.kt:360)
  	at com.varabyte.kobweb.api.Apis.register(Apis.kt:57)
That happens if my app ever tries to access the api.
Or if I start up the app from a clean slate.
d
Oh wow, I've never seen that.
Maybe it's an issue with the JDK being used to build the project?
r
I feel like there may be a java version difference or something.
Yah. I'm using:
Copy code
ryan[wagemix] (main)$ java -version
openjdk version "17.0.7" 2023-04-18 LTS
OpenJDK Runtime Environment Zulu17.42+19-CA (build 17.0.7+7-LTS)
OpenJDK 64-Bit Server VM Zulu17.42+19-CA (build 17.0.7+7-LTS, mixed mode, sharing)
Do you think I should downgrade to 11 or something?
d
I've been building with 22 so it shouldn't be necessary
r
I also notice other things as I was attempting to work around this. For example, I tried to create a kobweb server plugin and add api routes. I was indeed able to add routes to the server this way. However, The class loader could not find classes that were there if I looked at the classes available within the server jar.
d
I once ran into a similar list issue where a Kotlin extension changed behavior after a Java update.
Like, I think the Java API took over the Kotlin extension but then if your JDK was too old it would crash
r
Do you think I need to update to JDK 21 or something?
d
Looks like this was introduced recently
If you update to JDK 21 that should work, yes
r
Ooh.
d
Meanwhile, crazy more people haven't been yelling about this
r
Okay. I can just upgrade. I'm only using 17 because I tend to use it for most of my projects.
I think mostly people don't use the full stack features.
You may want to list JDK 21 that as a dependency on the documentation site (if it's not already listed)
d
Oh, no way
I'm going to fix it so that it stops crashing in JDK 17 🙂
r
Thanks.
That would be helpful.
In any case, When I upgraded to JDK 21, It started working. Thanks.
👍 1
And just FYI, the class loader still cannot find classes that it should be able to find inside of my kobweb server plugin.
(Same problem, different domain!)
r
Oh--The IDE provides a warning for this now.
(The removeFirst issue)
d
I think the safest thing for me to do is use
Copy code
kotlin.targets.withType(KotlinJvmTarget::class.java) { target ->
  target.compilations.configureEach {
    it.kotlinOptions.freeCompilerArgs += listOf(
      "-Xjdk-release=$javaVersion",
    )
  }
}
if that works. My intention 100% is to be compatible with JDK11.
👍 1
r
To be honest, I'd rather just write a kobweb server plugin and then configure Ktor with all the things I want to configure it with.
But that may just be because I don't know all the goodness I get from kobweb.
d
Well, the class that's calling the problematic code here is multiplatform, so I'm surprised it's not breaking on client code either. (It's the same class that registers routes for your page and handles navigation)
Should be fixed in 0.21.2+, thanks for reporting
👍 1