[
https://issues.apache.org/jira/browse/WINK-433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Arjan Seijkens updated WINK-433:
--------------------------------
Attachment: ClassUtils.patch
The org.apache.wink.common.internal.utils.ClassUtils#loadClass(String) method
seems to be introduced to fix the problem that in J2EE environments a class
like a provider we need here may be available on the thread class loader and
not on the current class loader and as such we need a method to load it using
the thread class loader and make sure it is prioritized over the system
class-loader. This behavior can be left in-tact, right now the
ClassUtils#loadClass(String) method however not only prioritizes the thread
context class-loader over the system class-loader, but also over the current
class-loader, which causes this issue. Therefore we have to refactor this a bit
so the method gives highest priority to the current class-loader when trying to
load a class and then still prioritizes the thread context class-loader over
the system class-loader.
> wink-providers not registered when running apache wink in osgi bundle on j2ee
> environment
> -----------------------------------------------------------------------------------------
>
> Key: WINK-433
> URL: https://issues.apache.org/jira/browse/WINK-433
> Project: Wink
> Issue Type: Bug
> Components: Common
> Affects Versions: 1.4
> Environment: Windows 7, WebSphere Application Server 8.5.5.5
> Reporter: Arjan Seijkens
> Attachments: ClassUtils.patch
>
>
> 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
> 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
(v6.3.4#6332)