WebSocket not working with Whiteboard-registration

Description

Currently registering a WebSocket via Whiteboard fails due to different reasons:

  1. The annotation-scan in the tracker fails due to different identities of the class used to check for the annotation.

  2. Jetty - If 1. is fixed the HttpServiceStarted times out

  3. Undertow - If passed 2. a javax.websocket.DeploymentException occurs claiming the class is not annotated correctly (probably same reason as for 1)

Jetty

HttpServerStarted

this fails because the Jetty adapter never handles the availability of WebSockets. Jetty must be telled to enabled a (Websocket)ServerContainer and provide the attribute in the ServletContext.

Undertow
Using Undertow with Whiteboard websockets gets (literally) one step further

HttpServerStarted

this call will end up ServerWebSocketContainer (Undertow) which is not able to compare the existing Annotations with each other because they both live in different classloaders (the bundle with the websocket-class and the undertow-lib).

Furthermore HttpContextStarted is missing an implementation for unregisterWebsocket.

Environment

None

Activity

Show:
Achim Nierbeck
December 2, 2016, 2:54 PM

I'd like to post-pone this to 6.0.1 ... any objections?

Marc Schlegel
December 4, 2016, 9:22 PM

Fine for me.

Róbert Csákány
May 5, 2017, 7:36 AM
Edited

I'm not sure my problems related to this issue, or it is a different one.

I have a problem with the PAX-Web. I've tried to register a Websocket service as declrarative, but it is unaccessible from web. I've tried the given websocket-jsr356-6.0.3.war and it works fine. As I see the WAR file handles differently the org.osgi.service.http.HttpContext. I've tried the following scenarios:

*Scenario 1 - OSGi R6 Whiteboard HTTP method*

Creating a ServletContextHelper:

And adding the Websocket Endpoint:

The logs show me that the Endpoint is catched. I've debugged and Pax-Web is registering it.

The log shows the following line:

2017-05-04 02:36:02,698 | INFO | Thread-70 | WebSocketTracker | 330 - org.ops4j.pax.web.pax-web-extender-whiteboard - 6.0.3 | found websocket endpoint!!

But the websocket is unaccessible with the following URL: ws://localost:8181/test/chat/testroom

*Scenario 2 - Pax-Web properties on registered HttpContext (with JAX-RS it works)*

Creating HttpContext instance: (Utilizing the OSGi given Helper abstract class):

And the Websocket Endpoint:

But the websocket is unaccessible with the following URL: ws://localost:8181/test/chat/testroom

How can I achive that webcsocket be available? I do not want to repackage my bundle as WAB. Is there any way?

Achim Nierbeck
May 7, 2017, 10:15 AM

this request actually better fits on the mailinglist:
https://groups.google.com/forum/#!forum/ops4j

Róbert Csákány
May 8, 2017, 6:23 PM

Thanks, I copy-paste this comment there.

Assignee

Marc Schlegel

Reporter

Marc Schlegel

Labels

None

Fix versions

Affects versions

Priority

Major
Configure