Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] WebSockets JSR 356, war files and Embedded Jetty

First, Tyrus is for containers that don't have their own WebSocket implementation.

Jetty (and Tomcat) both implement JSR356 natively, use those, not Tyrus.

Jetty, unlike Tomcat, is a modular container, everything is optional (even the Server!).
When you go standalone, the modules are glued together to fit the various specs most people are comfortable with.
When you go embedded, all of that glue is now on you to piece together to suit your needs specifically.
What is likely happening, is that you are including Tyrus (don't), and have not enabled the Annotation scanning.

To enable annotations ...

  org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
  classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration", 
     "org.eclipse.jetty.plus.webapp.EnvConfiguration", 
     "org.eclipse.jetty.plus.webapp.PlusConfiguration");
  classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", 
    "org.eclipse.jetty.annotations.AnnotationConfiguration");

Try that first.

Otherwise you can look at the embedded-jetty examples below ...

https://github.com/jetty-project/embedded-jetty-cookbook/tree/master/src/main/java/org/eclipse/jetty/cookbook/websocket/jsr/
https://github.com/jetty-project/embedded-jetty-websocket-examples
https://github.com/jetty-project/embedded-servlet-3.1


Joakim Erdfelt / joakim@xxxxxxxxxxx

On Sun, Apr 2, 2017 at 6:47 PM, <goffredo@xxxxxxxxxxx> wrote:

Hi,

I have been trying to load (into Jetty Embedded) the simple Echo example as presented by Danny Coward in the first chapter of his book Java WebSocket Programming (Oracle Press). His program is a variant of the standard echo example presented on the Tyrus site also. I use Eclipse Neon. I am not using Jetty WebSockets, rather I am using the Java JSR 356 WebSockets implementation. Also, I have no trouble with the embedded Jetty WebSockets examples, but I am trying to load a war file.

The program Danny presents works fine on current Tomcat, and as a war file, it also works fine on a standalone current Jetty. My problem is I am unable to take the exact same WebSockets war file that works OK on standalone Jetty and load it successfully into the Embedded Jetty. I do not know where to look, or what to do. Is it a setting problem? Or a Thread problem? Or ... If someone can point me in the right direction I would be thankful.

Regards
Goffredo


_______________________________________________
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