Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] @ServerEndpoint not working in jetty 9.2.5

Hi I try to run websocket on jetty-distribution-9.2.5.v20141112.

here the code :

+-----------------------

package com.kiwi;

import java.io.IOException;

import javax.websocket.OnMessage;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

@ServerEndpoint("/echo")
public class EchoEndPoint 
{
@OnMessage
public void onMessage(Session session, String message)
{
try {
for (Session sess : session.getOpenSessions()) {
           if (sess.isOpen())
              sess.getBasicRemote().sendText(message);
        }
} catch (IOException e) {
e.printStackTrace();
}
}

}

+---------------------------------

what i really do is, package it as war file, and put in the webapps, then run with 

java -jar C:\jetty-distribution-9.2.5.v20141112\start.jar jetty.base=C:\jetty jetty.home=C:\jetty-distribution-9.2.5.v20141112 --a
dd-to-start=deploy,http,jvm,websocket

then 

java -jar C:\jetty-distribution-9.2.5.v20141112\start.jar


however, i get the exception with start the server: 

2014-11-15 02:27:04.113:WARN:oejut.QueuedThreadPool:qtp300837073-16:
java.lang.IncompatibleClassChangeError: org/eclipse/jetty/annotations/Annotation
Parser$MyClassVisitor
        at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationPa
rser.java:974)
......

my --list-config contain this :

Jetty Active XMLs:
------------------
 ${jetty.home}\etc\jetty.xml
 ${jetty.home}\etc\jetty-http.xml
 ${jetty.home}\etc\jetty-deploy.xml
 ${jetty.home}\etc\jetty-plus.xml
 ${jetty.home}\etc\jetty-annotations.xml



I can run in tomcat 8,0.14 with no issue, do I forget to configure something ?

regards,
kiwi




Back to the top