[jira] [Updated] (WINK-433) wink-providers not registered when running apache wink in osgi bundle on j2ee environment

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (WINK-433) wink-providers not registered when running apache wink in osgi bundle on j2ee environment

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/WINK-433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arjan Seijkens updated WINK-433:
--------------------------------
    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.

  was:
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.


> 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 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)