eclipse-ee4j / eclipse-ee4j/tyrus

Tyrus Client throws a DeploymentException when deployed in an OSGI Context

Open
#659 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
128
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Glassfish Version: 5.1.0-RC1
Tyrus.Version: 1.14

I'm trying to use the Tyrus client from an OSGI Service that is deployed in Glassfish. However the call to ClientManager.createClient() throws a Deployment exception. (see below) The client is attempting to use the a utility class from the tyrus-core bundle that invokes the Class.ForName() method. Due to classloader isolation the tyrus-core service cannot locate the class in the tyrus-client bundle, thus it fails to construct the ClientManager class.

A sample project has been created to demonstrate the issue: https://github.com/pjs102/glassfish-5.1.0-bug-demos/tree/master/tyrus-client-test

A suggested workaround is to add the header "DynamicImport-Packge: org.glassfish.tyrus.*" to the tyrus-core project, thus allowing the ReflectionHelper to any class exported by the tyrus project.

---
Stack trace generated by calling ClientManager.createClient() in an OSGI context.

java.lang.RuntimeException: javax.websocket.DeploymentException: org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer not found by org.glassfish.tyrus.core [268]
at org.glassfish.tyrus.client.ClientManager.(ClientManager.java:277)
at org.glassfish.tyrus.client.ClientManager.createClient(ClientManager.java:243)
at org.glassfish.tyrus.client.ClientManager.createClient(ClientManager.java:219)
at pjs102.gf5demos.tyrus.client.Activator.runTest(Activator.java:50)
at pjs102.gf5demos.tyrus.client.Activator.start(Activator.java:39)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2240)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2146)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
Caused by: javax.websocket.DeploymentException: org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer not found by org.glassfish.tyrus.core [268]
at org.glassfish.tyrus.core.ErrorCollector.composeComprehensiveException(ErrorCollector.java:84)
... 15 more

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.