Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty and WebSockets

I figured this out, I added external dependencies provided in the jetty and added to the manifest of my server the web socket jars, now the servlet starts ok the jars are called ok and there are no duplicates, with a test page I can see connection ok and messages go through and have replies.

need to know now how to make different endpoints, now everything is connected to the EchoTest I will check the annotations.

for the client for example if I use javafx apart from the jar marked as client, which others are necessary?


On August 20, 2013 at 4:52:18 PM, Sebastian Gutierrez (scgm11@xxxxxxxxx) wrote:

I think I have an idea why this may be… 
can I contact you directly via Skype so I can show you?

JDK 1.7up 21
OS Ubuntu 12.04

the Manifest is to indicate my jar file, where are the jetty libraries located.

All these may be because how my environment is setted up.

As I told you I have a jar file that has the configuration of jetty by code, and the libs are the basic jetty libraries needed to run.
then the war file that has all the REST things has a web.xml that has the servlets parts, now with the Socket I had to add all the libraries of jetty that were needed not only the ones about web sockets.. so here is where I think that the instance is different so the null pointer, but I think is easier to show you directly sharing my screen and showing you the projects.

I have no idea if this could be achievable. I suppose that if I use other implementation on web socket directly could work… but I would like to stick to jetty.


On August 20, 2013 at 4:29:16 PM, Joakim Erdfelt (joakim@xxxxxxxxxxx) wrote:

Odd, very odd.

You are definately using websocket correctly, and your servlet is being hit.
However, these 2 lines are causing a NPE for you.

Now why is HttpConnection.getCurrentConnection() null for you?

The HttpConnection:229 is present on your stacktrace.
And a few lines above that handle method is the setting of your current connection.

That is a very strange bug you are experiencing.
What JDK are you using? And on what OS?
I'd like to attempt to replicate.

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

On Tue, Aug 20, 2013 at 12:04 PM, Sebastian Gutierrez <scgm11@xxxxxxxxx> wrote:
I've move a bit forward:


this is the exception...

 2013-08-16 20:42:35.458:WARN:oejs.ServletHandler:qtp1118598848-18: /Integra/websockets/
        at org.eclipse.jetty.websocket.server.WebSocketServerFactory.upgrade(
        at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(
        at org.eclipse.jetty.websocket.servlet.WebSocketServlet.service(
        at javax.servlet.http.HttpServlet.service(
        at org.eclipse.jetty.servlet.ServletHolder.handle(
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
        at org.eclipse.jetty.servlet.ServletHandler.doScope(
        at org.eclipse.jetty.server.session.SessionHandler.doScope(
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
        at org.eclipse.jetty.server.handler.HandlerList.handle(
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
        at org.eclipse.jetty.server.Server.handle(
        at org.eclipse.jetty.server.HttpChannel.handle(
        at org.eclipse.jetty.server.HttpConnection.onFillable(
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
        at org.eclipse.jetty.util.thread.QueuedThreadPool$

maybe this is wrong on my xml:




On August 20, 2013 at 3:47:34 PM, Sebastian Gutierrez (scgm11@xxxxxxxxx) wrote:

forget about this, is the manifest wrong…

On August 20, 2013 at 3:35:19 PM, Sebastian Gutierrez (scgm11@xxxxxxxxx) wrote:

is there any breaking changes for embedded between 9.0.3 and 9.04 and 9.05 because I'm moving from 3 to 5 and now I have 
this exception

root@server:/etc/IntegraServer/server# Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/HttpConfiguration$Customizer
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(
        at java.lang.Class.getMethod0(
        at java.lang.Class.getMethod(
        at sun.launcher.LauncherHelper.getMainMethod(
        at sun.launcher.LauncherHelper.checkAndLoadMain(
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.HttpConfiguration$Customizer
        at Method)
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        ... 6 more

although the class seems to be on the jetty server jar……

any idea??

then I will move further on the web socket issue, 9.0.3 doesn't have a web socket client jar..

On August 20, 2013 at 2:52:19 PM, Joakim Erdfelt (joakim@xxxxxxxxxxx) wrote:


And then type in your websocket uri and try it out.

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

On Tue, Aug 20, 2013 at 10:43 AM, Sebastian Gutierrez <scgm11@xxxxxxxxx> wrote:
that's exactly as I have done, but it seems that JettyWebSocketServlet never gets executed, for example if I add some log on the configure override method, that one is never executed. when the server start, maybe it does´t get executed until the first request or something like that?? is there any simple way to test the web socket? lets say pasting the url on a web browser that supports them?? or is there any thin client out there to check it?

any other pointer??

thanks a lot!

On August 20, 2013 at 2:35:52 PM, Joakim Erdfelt (joakim@xxxxxxxxxxx) wrote:

hine.hostname" is your server's host name (or ip)
The "port" is the non-SSL port you have configured your server on.
The "webapp.context" is the context path where you deployed your web application
and "/websockets/" is the request path you have specified in your servlet-mapping

Back to the top