users@tyrus.java.net

Tyrus Websocket Client Endpoints and OSGI bundle

From: Beaulieu, Paul <Paul.Beaulieu_at_parexel.com>
Date: Mon, 20 Apr 2015 13:08:23 +0000

Hi,

I have an OSGI bundle in which I am trying to start a Websocket client. The problem is that the org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer cannot be found. The issue is that the bundle classloader for the tyrus-core cannot find this class. If everything is placed into a normal jar file, then it all works. The problem is with the classloaders being able to find the tyrus classes that are required.

The code snippet that I have is below

              ClientEndpointConfig cec = ClientEndpointConfig.Builder.create().build();
              ClientManager client = ClientManager.createClient();

              client.connectToServer(this, cec, new URI(endpoint));

The problem is at the ClientManager.createClient() where the GrizzlyClientContainer cannot be found with the following exception:
java.lang.ClassNotFoundException: org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer not found by org.glassfish.tyrus.core [30]

Is there anything special that needs to be done in order for this to work in an OSGI bundle?

I am using an apache Felix framework for loading the OSGI bundles.

Thanks for any help you can provide.

Paul Beaulieu