Hello Also remember that Karaf 4.4.x uses Pax Web 8 and web socket handling was changed - or rather made more standard.
https://github.com/ops4j/org.ops4j.pax.web/tree/main/samples/samples-war/war-websocket-jsr356 is a WAR/WAB example, where a websocket is simply detected because of "@javax.websocket.server.ServerEndpoint" annotation. https://github.com/ops4j/org.ops4j.pax.web/blob/main/pax-web-itest/pax-web-itest-container/pax-web-itest-container-common/src/main/java/org/ops4j/pax/web/itest/container/websockets/AbstractWebSocketWhiteBoardIntegrationTest.java shows a whiteboard example for websocket registration. Karaf's "examples/karaf-websocket-example" is kind of proprietary (works with Jetty only - explicitly extending org.eclipse.jetty.websocket.servlet.WebSocketServlet servlet) and such servlet isn't even available in Jetty 10. kind regards Grzegorz Grzybek sob., 22 paź 2022 o 07:01 Jean-Baptiste Onofré <[email protected]> napisał(a): > Hi, > > If you take a look on the karaf-websocket-example > ( > https://github.com/apache/karaf/tree/main/examples/karaf-websocket-example > ), > you can find some tips: > > 1. you have to install pax-web-jetty-websockets feature > 2. starting from Jetty 9.4.49, you will have to add > org.eclipse.jetty.websocket.server import > ( > https://github.com/apache/karaf/blob/main/examples/karaf-websocket-example/pom.xml#L65 > ). > This is the point you are looking for. It's a workaround for this > Jetty issue. Just adding this import in your websocket bundle is OK. > > Regards > JB > > On Fri, Oct 21, 2022 at 5:52 PM Mark Smith <[email protected]> wrote: > > > > Hello, > > > > I'm currently going through a Karaf upgrade from 4.2.10 to 4.4.1. I'm > having a problem resolving dependencies with the Jetty websocket jars. > I've found 2 other threads discussing this: > > > > > https://stackoverflow.com/questions/26161735/java-lang-classnotfoundexception-org-eclipse-jetty-websocket-server-websocketse > > and > > https://github.com/eclipse/jetty.project/issues/7835 > > > > but neither one seems to have a solution. It appears that > org.eclipse.jetty.websocket:websocket-servlet has a DynamicImport-Package > dependency on org.eclipse.jetty.websocket:websocket-server that is not > successful. I've attempted some spifly magic as well as manually changing > the manifest to a Import-Package instead of DynamicImport-Package with no > success. > > > > My next step is to try to create a shaded jar to get around the issue > but wanted to see if this was a known problem with a solution. > > > > Thanks for any feedback, > > Mark >
