darkmoon_uk
05/30/2021, 8:10 AMHttpServletRequest.upgrade()
which is not supported in Jetty ☠️
This appears to be a complete blocker for deploying WebSockets as a WAR in Jetty. Disturbing given that it's a very standard configuration for production usage 😱
Is anyone able to suggest a fix or workaround? Reproduction steps added to ticket.Chris Miller
05/30/2021, 1:12 PMdarkmoon_uk
05/31/2021, 1:13 PMdocker:latest
container. It transpires that latest
is Jetty version 9.x
- while 10.x
and 11.x
version streams also exist.
I tested these:
• 9.x
, as already seen, doesn't implement the connection upgrade()
method that Ktor calls internally from its WebSocket implementation.
• 11.x
is plainly unsuitable - it represents Jetty project's 'big bang' move to a new Jakarta project servlet standard and doesn't recognise the javax.*
family of Servlet classes at all.
• That leaves 10.x
- I hoped this would work but instead I get a new error from the Server when it attempts to open the WebSocket session: ERROR Application - 101 Switching Protocols: GET - /web-getting-started-webapp/numberUpdates java.lang.IllegalStateException: s=WAITING rs=ASYNC os=OPEN is=IDLE awp=false se=false i=false al=0
e5l
05/31/2021, 2:27 PMdarkmoon_uk
06/01/2021, 9:51 AMjetty-war
sample:
• There's nothing about it that looks Jetty specific - could/should be called servlet-war
?
• The Gretty plugin version referenced is unmaintained, and should be updated to org.gretty
, 3.0.4
• The sample doesn't work because the main module referenced in application.conf
isn't fully qualified. Changing it to io.ktor.snippets.hello.HelloApplicationKt.main
makes it work.
I'll probably raise a PR with these fixes soon.install(WebSockets)
and webSocket("/ws") { send(Frame.Text("Hello")) }
to the lightly fixed jetty-war
sample, gives rise to:
2021-06-01 14:43:41.914 [pool-20-thread-3] ERROR Application - 101 Switching Protocols: GET - /jetty-war/ws
java.lang.IllegalStateException: s=WAITING rs=ASYNC os=OPEN is=IDLE awp=false se=false i=false al=0
...
war
is deployed in my Dockerised Jetty 10.x Container instance.1.6.0
, so WS still broken there 😞