The servlet container doesn't support the Java API for WebSocket (JSR 356)

Environment

  • Ubuntu Linux 22.04.2
  • xwiki-tomcat9-mysql 16.7.1 (ROOT APP)
  • Includes URL shortening
  • using SSL keystore for TLS

Hey everyone,

I’m facing a challenge with my XWiki setup and could really use your expertise. Upon starting Tomcat 9, I encounter the following warning in the logs:

WARN  x.w.i.XWikiEndpointInitializer - The servlet container doesn't support the Java API for WebSocket (JSR 356).

This warning seems to be causing issues with the real-time WYSIWYG editing feature, which gets stuck on ‘connecting to colab. session.’ Additionally, attempts to establish a WebSocket connection via Netflux are timing out and restarting during sessions.

I’ve attempted to make changes in the server.xml and web.xml files but this has not solved the issue.

Has anyone encountered a similar issue or have any pointers on how to enable WebSocket support in this environment? Any advice would be greatly appreciated!

Thanks in advance for your help!

server-pruned.txt (3.0 KB)

Hello, I don’t know if this is still an issue?

cc @mflorea

The Java WebSocket specification (JSR 356) mentions this:

The web-
socket implementation must make the ServerContainer instance corresponding to this application available
to the developer as a ServletContext attribute registered under the name javax.websocket.server.ServerContainer.

The warning you get is because Tomcat (that should provide the WebSocket implementation) doesn’t put a (WebSocket) ServerContainer instance on the ServletContext under the javax.websocket.server.ServerContainer key. So this looks like a Tomcat configuration problem. You need to see how to enable WebSocket support (JSR 356) in Tomcat. I’d start with Apache Tomcat 9 (9.0.98) - WebSocket How-To .

Hope this helps,
Marius