[ 
https://issues.apache.org/jira/browse/OWB-931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13894765#comment-13894765
 ] 

Moritz Bechler commented on OWB-931:
------------------------------------

Ok, the first part makes sense. It might still be desirable to do this in osgi 
(maybe configurable?) and live with this restriction. If I see correctly the 
Proxy class is injected a static reference to the instance provider which may 
leak in this case. 

The import problem is not about the proxy class:
{code}
ClassLoader classLoader = bean.getBeanClass().getClassLoader();
[...]
String className = // configured scope provider
instanceProviderClass = (Class<? extends Provider>) Class.forName(className, 
true, classLoader);
{code}
This loads the scope provider which is configured in some .properties file from 
the bean class classloader - which should only need to know about the interface 
(scope annotation) and not about the scope provider implementation.


> NormalScopeProxyFactory classloader usage
> -----------------------------------------
>
>                 Key: OWB-931
>                 URL: https://issues.apache.org/jira/browse/OWB-931
>             Project: OpenWebBeans
>          Issue Type: Brainstorming
>          Components: Core
>    Affects Versions: 1.2.0
>            Reporter: Moritz Bechler
>              Labels: ClassLoader, OSGI
>
> createNormalScopeProxy currently uses the bean class ClassLoader for two 
> purposes:
> 1. defining the proxy class
> 2. instantiation of the instance provider.
> In our OSGI/WAB environment this usage does not make much sense:
> 1. the proxy class should be defined in the classloader which most closely 
> reflects the CDI context lifecycle, which is the web context TCCL. 
> 2. causes trouble with scope providers (e.g OWB's own 
> RequestScopedBeanInterceptorHandler) when they are defined in another bundle. 
> I don't think there is a proper compatible solution to this (except maybe 
> making extensions fragments) but also trying the TCCL makes this much more 
> painless to use.
> Is there any explanation for this particular choice of classloaders? Are 
> there any reasons not to try TCCL first?



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to