[jira] [Created] (WINK-433) wink-providers not registered when running apache wink in osgi bundle on j2ee environment
Arjan Seijkens created WINK-433:
Summary: wink-providers not registered when running apache wink in osgi bundle on j2ee environment
URL: https://issues.apache.org/jira/browse/WINK-433 Project: Wink
Issue Type: Bug
Affects Versions: 1.4
Environment: Windows 7, WebSphere Application Server 126.96.36.199
Reporter: Arjan Seijkens
I Have a WebSphere Application Server 188.8.131.52 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 classloader.
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 classloader and the org.apache.wink.common.internal.utils.ClassUtils#loadClass(String) method first checks that classloader when loading classes.
As a result the loaded class will be annotated with a javax.ws.rs.ext.Provider class from the thread context classloader 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 classloader) and thus doesn't recognize the class as a Provider class and doesn't register it.
This message was sent by Atlassian JIRA