Hi David, Im getting the following exception after...
# http4k
a
Hi David, Im getting the following exception after upgrading from
3.179.0
to 3.185.0`
Copy code
Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Class.getPackageName()Ljava/lang/String;
	at org.http4k.core.MimeTypes$Companion.loadStandard(MimeTypes.kt:29)
	at org.http4k.core.MimeTypes$Companion.access$loadStandard(MimeTypes.kt:12)
	at org.http4k.core.MimeTypes$Companion$standardTypes$2.invoke(MimeTypes.kt:16)
	at org.http4k.core.MimeTypes$Companion$standardTypes$2.invoke(MimeTypes.kt:12)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at org.http4k.core.MimeTypes$Companion.getStandardTypes(MimeTypes.kt)
	at org.http4k.core.MimeTypes$Companion.invoke(MimeTypes.kt:14)
	at org.http4k.routing.ResourceLoadingHandler.<init>(internal.kt:24)
	at org.http4k.routing.StaticRoutingHttpHandler.<init>(internal.kt:55)
	at org.http4k.routing.StaticRoutingHttpHandler.<init>(internal.kt:48)
	at org.http4k.routing.RoutingKt.static(routing.kt:57)
	at com.johnlewis.recommendations.controller.ApiHandler.invoke(ApiHandler.kt:111)
	at com.johnlewis.recommendations.Application.<init>(Application.kt:57)
	at com.johnlewis.recommendations.ApplicationKt.main(Application.kt:89)
	at com.johnlewis.recommendations.ApplicationKt.main(Application.kt)
This happens for StaticRoutingHandler serving static content.
d
This is because the jdk that you're using is Java 8 (which is EOL). That method was added in Java 9. Are you able to use Java 9?
(you really should be using Java 11 btw)
x
Java 8 is not EOL, you find builds by AdoptOpenJDK with an end of availability scheduled for at least 2023.
d
@Xavier Hanin ah - thanks for pointing that out 🙃. I’d already removed the offending API calls anyway (it was quite an incidental usage) to go out in the next version, but will push out a fixed version tmrw.
x
Great! I think there are still many people stuck with Java 8, and with Kotlin staying compatible with Java 8 platform sounds acceptable
d
Yeah - if they are stuck with that then we definitely don't want to make life even harder. 😉
@Anil I've just released 3.186.0 which reverts the java 9 requirement. let us know if you still have problems
a
Thanks David for reverting back. Thanks @Xavier Hanin for pointing out.