tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Unable to establish WebSocket connection on Tomcat Embed (9.0.24)
Date Mon, 04 Nov 2019 13:55:27 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alex,

On 11/4/19 07:59, Alexander Stöcker wrote:
> My code is basically just:
> 
> Tomcat tomcat = new Tomcat(); tomcat.getConnector(); 
> tomcat.setPort(8080);
> 
> Context context = tomcat.addContext("/context", new 
> File(".").getAbsolutePath());
> 
> // servlet Tomcat.addServlet(context, "myServlet", new
> MyServlet()); context.addServletMappingDecoded("/hello",
> "myServlet");
> 
> // websocket 
> context.addApplicationListener(MyWSContextListener.class.getName());
>
>  // run tomcat.start(); tomcat.getServer().await();


Can you provide some of the code for MyWSContextListener and/or
MyServlet? Also, is the endpoing /hello or /endpoint? I'm assuming
that was a sanitization error when writing-up this post.

> The WsContextListener is adding an Endpoint when
> contextInitialized() is called. Setting a Breakpoint shows that the
> code is actually executed. The Servlet is working but when I'm
> trying to connect to the endpoint
> ("ws://localhost:8080/context/endpoint") I get a 404. On Fine debug
> output I can see, that this exception is thrown, whenever a 
> connection is requested:

How are you invoking ws://localhost:8080/context/endpoint? Web
browser? Custom client? Can you share that code at all?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3ALc8ACgkQHPApP6U8
pFif+RAAiKY4UVasx8OuaxIU2hS0ukq3/s1Ek3Z5MVzE4GSDzNaEG0Re0t2ObEs7
fW2nUQ0LMibqKgWT5E73lHf/E0FRdk87CL0y1kPK+w78tgdybiedgVPV4pwNqAVB
pl6oBhyilKklkKhbslju6lufRxc76n+mW30/rgxT2Mc7ul56PPy5DHZIJOGWv9Qx
NYjI6lo+ysZAK2Dzfl/3xSVxf583IRL+hTu/1U4R/SpNxjLo3mz4MF2DNjh7/wBT
dQd8lII26SD5s5qC73n/5blhoXWFP1wl0XX33s7fZ1pglaBYBxD2HrPxzfh+UaIR
cdoRwz1tWQFh2wNQuOGTaa04EbrU0cuLy2uiJPP4eOe2u7+M7Ij9FFaNclH8zeHs
RYw5W1nWcZInv47q5uhJiVcDgDmcOH4QcDj4QLSBLEK1Q86SIN/wk71IAvFyktVK
ewjLEUp+0a4NtJWgE8tQN7wh5m9GAQKOcXCT0hm/pAWpfBChtljXh5Q041aNjzpn
YXrQu39+kjB/dl01J1kTtUF9krzhSaKiGcy7UakOMS17Slj3H4kfRi89mg0IvJwP
d0vWJCpwkMqDUF1g1xZ6rhLZmo3cSuAcd2RDHkOOPzX4eutE3H/XirGNGi5v/1yG
yrK7FHBNKQU6suFnplBGikaK9J+3M7Nn5FrFBzutLXY1BDiKAGY=
=ePzu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message