Websockets and HK2

30 views
Skip to first unread message

Zeljko Milinkov

unread,
Mar 10, 2023, 8:37:11 AM3/10/23
to dropwizard-user
Hi all,
I'm trying to implement a websocket that can use injected objects using dw 4 beta.4 with jetty 11. Using WebSocketAdapter I can get the websocket to work using environment.servlets().addServlet() or environment.getApplicationContext().addServlet(), but without injected objects. I tried to replace JettyWebSocketServlet with my own, and change the register method to use ServiceLocator createAndInitialize() instead of just calling the constructor, but then I get the error "There was no object available in __HK2_Generated_0 for injection at SystemInjecteeImpl".

Injected objects work with REST endpoints in the same app.

How can I make this work?

Thanks
Reply all
Reply to author
Forward
0 new messages