Hello Bertrand, Thanks a lot fort he hints! Indeed, I faced the same issue reported on the felix mailing list (java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory) during the init() invocation on my web socket servlet. This is because there is a Loader abstraction in the jetty websocket implementation that is not OSGi friendly, i.e. it uses the service loader pattern and falls back to the context class loader (ugh...). The same was reported in the felix developer discussion you mentioned.
Regardless, I've gotten it to work by wrapping the init() method in a try/catch block temporarily setting the context class loader to the current bundle's class loader. This did the trick. Regards, Olaf -----Original Message----- From: Bertrand Delacretaz [mailto:bdelacre...@apache.org] Sent: Dienstag, 5. April 2016 11:24 To: users <users@sling.apache.org> Subject: Re: Websockets in Sling Hi Olaf, On Tue, Apr 5, 2016 at 11:11 AM, Olaf <o...@x100.de> wrote: > ...Has anyone implemented a server-side websocket in Sling? While the > jetty API is around, I'm not sure how to make best use of it and how > this works in conjunction with @SlingServlet & co.... A few experiments exist, like https://github.com/bobpaulin/sling-websocket and SLING-4616 was created a year ago to investigate this but I don't think we something in our "official" modules. I'm not sure if it's a Sling concern or rather a Felix HTTP service concern, however - there were some discussions in Felix a while ago [1] including interesting pointers. I support creating a "Sling native" option for web sockets...as long as people promise not to abuse them ;-) -Bertrand [1] http://felix.markmail.org/thread/ems4ih7653pvtkz5