I'm trying to implement a jsr 356 websocket connection from within a war deployed in jetty.
I'm using this as a guide: http://aredko.blogspot.com/2013/11/java-websockets-jsr-356-on-jetty-91.html
(I can find lots of tutorials on basically using jsr 356 with an embedded jetty server, but none on building a websocket connection within an existing server - are there any good ones out there?)
Whenever I run the code listed above, I get the following error:
java.lang.LinkageError: loader constraint violation: when resolving method "org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.configureContext(Lorg/eclipse/jetty/servlet/ServletContextHandler;)Lorg/eclipse/jetty/websocket/jsr356/server/ServerContainer;" the class loader (instance of org/eclipse/jetty/webapp/WebAppClassLoader) of the current class, com/me/stuff/data/DataServer, and the class loader (instance of org/eclipse/jetty/start/Classpath$Loader) for resolved class, org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer, have different Class objects for the type y.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.configureContext(Lorg/eclipse/jetty/servlet/ServletContextHandler;)Lorg/eclipse/jetty/websocket/jsr356/server/ServerContainer; used in the signature
which refers to the code
ServerContainer container = WebSocketServerContainerInitializer.configureContext(context);
I'm at a loss to figure this out. I'm using the following lines from gradle to bring in the websocket stuff:
providedCompile (
[ group: 'javax.websocket', name: 'javax.websocket-api', version: '+'],
[ group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '+' ]
)
compile (
[ group: 'org.eclipse.jetty.websocket', name: 'javax-websocket-server-impl', version: '+'],
[ group: 'org.eclipse.jetty.websocket', name: 'javax-websocket-client-impl', version: '+']
)
I see that both the javax-websocket-server-impl jar and the javax.websocket-api jar contain ServerContainer classes...but I'm only including one of those in my war file. Is jetty pulling from its own internal older version? Or am I completely misreading the source of the issue?
The jetty version I have is: jetty-9.2.1.v20140609