https://kotlinlang.org logo
#http4k
Title
# http4k
m

MrNiamh

04/14/2022, 11:52 AM
Hey, a colleague is trying to run https://www.http4k.org/guide/howto/serve_websockets/ but having some issues when adding it to an existing project (works fine from a new maven project), and are raised at the asServer…start() line. When using Undertow they get:
Copy code
Exception in thread "main" java.lang.NoSuchMethodError: 'org.http4k.core.Filter org.http4k.filter.ServerFilters$CatchAll.invoke$default(org.http4k.filter.ServerFilters$CatchAll, kotlin.jvm.functions.Function1, int, java.lang.Object)'
               at org.http4k.server.Http4kUndertowHttpHandler.<init>(Http4kUndertowHttpHandler.kt:20)
               at org.http4k.server.Undertow.toServer(Undertow.kt:24)
               at org.http4k.server.PolyServerConfig$DefaultImpls.toWsServer(PolyServerConfig.kt:15)
               at org.http4k.server.Undertow.toWsServer(Undertow.kt:19)
               at org.http4k.server.RealtimeExtensionsKt.wsHandlerAsServer(realtimeExtensions.kt:19)
               at com.asurafin.trading.mstar.stream.WsPolyTestKt.main(WsPolyTest.kt:62)
               at com.asurafin.trading.mstar.stream.WsPolyTestKt.main(WsPolyTest.kt)
When using jetty they get:
Copy code
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Exception in thread "main" java.lang.NoSuchMethodError: 'java.util.stream.Stream org.eclipse.jetty.util.TypeUtil.serviceStream(java.util.ServiceLoader)'
               at org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry.<init>(WebSocketExtensionRegistry.java:33)
               at org.eclipse.jetty.websocket.core.WebSocketComponents.<init>(WebSocketComponents.java:55)
               at org.eclipse.jetty.websocket.core.WebSocketComponents.<init>(WebSocketComponents.java:49)
               at org.eclipse.jetty.websocket.core.WebSocketComponents.<init>(WebSocketComponents.java:43)
               at org.http4k.server.Jetty.toServer(jetty.kt:38)
               at org.http4k.server.PolyServerConfig$DefaultImpls.toWsServer(PolyServerConfig.kt:15)
               at org.http4k.server.Jetty.toWsServer(jetty.kt:26)
               at org.http4k.server.RealtimeExtensionsKt.wsHandlerAsServer(realtimeExtensions.kt:19)
They’re still investigating themselves what could be causing it, but just wondering if anyone has seen this before as the exceptions aren’t massively helpful
s

s4nchez

04/14/2022, 11:54 AM
My initial bet is different versions of jetty (or http4k?). Could you compare them to check?
d

dave

04/14/2022, 12:08 PM
We recently changed the CatchAll filter so it does seem like there might be something fishy going on at built time.
m

MrNiamh

04/14/2022, 12:32 PM
d’oh, that was indeed it, thanks. A cheeky library was importing some different versions
d

dave

04/14/2022, 12:32 PM
👍
5 Views