everrest
everrest copied to clipboard
Can't run the book-service with websocket
I've run the everrest-samples/book-service
example:
mvn clean install
mvn package
mvn jetty:run
The api is working well: http://localhost:8080/book-service/books/101.
But if I visit it with "Advanced REST client" for the ws url: ws://localhost:8080/book-service/ws, it can't be connected. At meanwhile, the console of mvn prints error:
[WARNING]
java.lang.NoSuchMethodError: javax.websocket.Session.addMessageHandler(Ljava/lang/Class;Ljavax/websocket/MessageHandler$Whole;)V
at org.everrest.websockets.WSConnectionImpl.onOpen(WSConnectionImpl.java:75)
at org.eclipse.jetty.websocket.jsr356.endpoints.JsrEndpointEventDriver.onConnect(JsrEndpointEventDriver.java:140)
at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.openSession(AbstractEventDriver.java:220)
at org.eclipse.jetty.websocket.jsr356.endpoints.AbstractJsrEventDriver.openSession(AbstractJsrEventDriver.java:104)
at org.eclipse.jetty.websocket.common.WebSocketSession.open(WebSocketSession.java:424)
at org.eclipse.jetty.websocket.server.WebSocketServerConnection.onOpen(WebSocketServerConnection.java:76)
at org.eclipse.jetty.io.AbstractEndPoint.upgrade(AbstractEndPoint.java:191)
at org.eclipse.jetty.server.HttpConnection.onCompleted(HttpConnection.java:363)
at org.eclipse.jetty.server.HttpChannel.onCompleted(HttpChannel.java:525)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:414)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:237)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:240)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:93)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.produceAndRun(ExecuteProduceRun.java:191)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.run(ExecuteProduceRun.java:126)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:641)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:559)
at java.lang.Thread.run(Thread.java:745)
2016-02-26 13:08:20,235[qtp177389135-14] [DEBUG] [o.e.w.WSConnectionContext 97] - Close connection WSConnectionImpl{id=1, wsSession=websocket-1, channels=[]} with status 1011
I checked the dependencies of the project is:
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EverRest :: Book Service 1.13.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ book-service ---
[INFO] org.everrest:book-service:war:1.13.0-SNAPSHOT
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- javax.websocket:javax.websocket-api:jar:1.1:provided
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.2:runtime
[INFO] | +- ch.qos.logback:logback-core:jar:1.1.2:runtime
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.6:runtime
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2.1:runtime
[INFO] +- javax.annotation:javax.annotation-api:jar:1.2:runtime
[INFO] +- javax.mail:mail:jar:1.4.4:runtime
[INFO] +- org.everrest:everrest-core:jar:1.13.0-SNAPSHOT:runtime
[INFO] | +- com.google.guava:guava:jar:18.0:runtime
[INFO] | \- commons-io:commons-io:jar:2.4:runtime
[INFO] \- org.everrest:everrest-websockets:jar:1.13.0-SNAPSHOT:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.359 s
[INFO] Finished at: 2016-02-26T13:13:11+08:00
[INFO] Final Memory: 17M/309M
[INFO] ------------------------------------------------------------------------
related jetty issue https://github.com/eclipse/jetty.project/issues/207