users@tyrus.java.net

Re: Tyrus Websocket Client Endpoints and OSGI bundle

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Mon, 20 Apr 2015 15:26:41 +0200

Hi Paul,

can you please share reproducible testcase? (preferably: minimal, github
hosted, maven project).

We do test this only on Glassfish, which is OSGi container, but from
what I recall, there are some internal inconsistencies when compared to
plan Felix / other containers.

Thanks,
Pavel

On 20/04/15 15:08, Beaulieu, Paul wrote:
>
> 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
>