Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.4
-
None
-
None
-
Windows 7, WebSphere Application Server 8.5.5.5
-
Patch Available
Description
I have a WebSphere Application Server 8.5.5.5 on which I deploy my application which contains an OSGi bundle which contains the wink-server and wink-common libraries.
When starting the application (and the bundle) all default MessageBodyReaderProviders and MessageBodyWriterProviders as listed in the wink-providers file, which are part of the wink-common.jar are registered. All classes in that file are loaded by the org.apache.wink.common.internal.utils.ClassUtils#loadClass(String) method and then checked to see if they represent a Provider, by checking if they are annotated with the javax.ws.rs.ext.Provider class. All these classes are part of the webmanager-jaxrssupport-bundle and available on its own contained class-loader.
This causes problems in WebSphere, because both the javax.ws.rs.ext.Provider class and the classes listed in the wink-providers file are also available on the thread context class-loader and the org.apache.wink.common.internal.utils.ClassUtils#loadClass(String) method first checks that class-loader when loading classes.
As a result the loaded class will be annotated with a javax.ws.rs.ext.Provider class from the thread context class-loader and the logic which checks if it is annotated check against a javax.ws.rs.ext.Provider class from the current classloader (webmanager-jaxrssupport-bundle's own contained class-loader) and thus doesn't recognize the class as a Provider class and doesn't register it.