Skip to main content

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

Just tried it out.

Works fine.

Example project at: https://github.com/jetty-project/websocket-basic-webapp

See readme.txt

This is a maven project and a valid ${jetty.base} directory.

You can run it directly in the jetty-distribution ...

[joakim@lapetus websocket-basic-webapp]$ java -jar ~/code/jetty/distros/jetty-distribution-9.2.5.v20141112/start.jar
2014-11-14 14:49:07.006:INFO::main: Logging initialized @273ms
2014-11-14 14:49:07.159:INFO:oejs.Server:main: jetty-9.2.5.v20141112
2014-11-14 14:49:07.171:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/home/joakim/code/jetty/examples/websocket-basic-webapp/webapps/] at interval 1
2014-11-14 14:49:07.332:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /wsecho, did not find org.apache.jasper.servlet.JspServlet
2014-11-14 14:49:07.681:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@f6b6cdf{/wsecho,file:/tmp/jetty-0.0.0.0-8080-wsecho.war-_wsecho-any-2647046263325507583.dir/webapp/,AVAILABLE}{/wsecho.war}
2014-11-14 14:49:07.688:INFO:oejs.ServerConnector:main: Started ServerConnector@1b343e35{HTTP/1.1}{0.0.0.0:8080}
2014-11-14 14:49:07.688:INFO:oejs.Server:main: Started @962ms
^C
2014-11-14 14:49:26.802:INFO:oejs.ServerConnector:Thread-0: Stopped ServerConnector@1b343e35{HTTP/1.1}{0.0.0.0:8080}
2014-11-14 14:49:26.804:INFO:oejsh.ContextHandler:Thread-0: Stopped o.e.j.w.WebAppContext@f6b6cdf{/wsecho,file:/tmp/jetty-0.0.0.0-8080-wsecho.war-_wsecho-any-2647046263325507583.dir/webapp/,UNAVAILABLE}{/wsecho.war}


--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Fri, Nov 14, 2014 at 2:31 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
The error you are getting is typically seen when ...

 * server somehow has a bad/old objectweb-asm.jar
 * from putting jetty classes into the WEB-INF/lib (bad idea, remove them)
 * from having a strange classloader configuration that inverts the classloader priority improperly.

Meanwhile, let me see if I can whip up a quick webapp with that example websocket in it and try it out.

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Fri, Nov 14, 2014 at 12:04 PM, Kiwi de coder <kiwionly@xxxxxxxxx> wrote:

Standard i think.. WEB-INF/lib, however that is no jar file inside, as i support it will using javax.websocket.* from jetty server (like tomcat) the source is the only class file in the war.

On Nov 15, 2014 2:51 AM, "Joakim Erdfelt" <joakim@xxxxxxxxxxx> wrote:
What is in your war's WEB-INF/lib directory?

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Fri, Nov 14, 2014 at 11:38 AM, Kiwi de coder <kiwionly@xxxxxxxxx> wrote:
here the entire server logs:


2014-11-15 02:37:46.501:INFO:oejs.Server:main: jetty-9.2.5.v20141112
2014-11-15 02:37:46.535:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/C:/jetty/webapps/] at interval 1
2014-11-15 02:37:47.693:WARN:oejut.QueuedThreadPool:qtp21102086-21: 
java.lang.IncompatibleClassChangeError: class org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor has interface org.objectweb.asm.ClassVisitor as super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956)
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:162)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:547)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)
at java.lang.Thread.run(Unknown Source)
2014-11-15 02:37:47.694:WARN:oejut.QueuedThreadPool:qtp21102086-21: Unexpected thread death: org.eclipse.jetty.util.thread.QueuedThreadPool$3@75e5c2cc in qtp21102086{STARTED,10<=10<=200,i=8,q=0}
2014-11-15 02:37:47.693:WARN:oejut.QueuedThreadPool:qtp21102086-20: 
java.lang.IncompatibleClassChangeError: org/eclipse/jetty/annotations/AnnotationParser$MyClassVisitor
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:702)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:824)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:162)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:547)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)
at java.lang.Thread.run(Unknown Source)
2014-11-15 02:37:47.697:WARN:oejut.QueuedThreadPool:qtp21102086-20: Unexpected thread death: org.eclipse.jetty.util.thread.QueuedThreadPool$3@75e5c2cc in qtp21102086{STARTED,10<=10<=200,i=9,q=0}
2014-11-15 02:37:47.871:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@37c4b9a5{/websocket,file:/C:/jetty/webapps/websocket/,AVAILABLE}{C:\jetty\webapps\websocket.war}
2014-11-15 02:37:47.898:INFO:oejs.ServerConnector:main: Started ServerConnector@7dbc244d{HTTP/1.1}{0.0.0.0:8080}
2014-11-15 02:37:47.899:INFO:oejs.Server:main: Started @2116ms


On Sat, Nov 15, 2014 at 2:36 AM, Kiwi de coder <kiwionly@xxxxxxxxx> wrote:
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





_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top