You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Arjan Seijkens (JIRA)" <ji...@apache.org> on 2015/05/06 16:21:00 UTC

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

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

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