I am testing things and didnt put it as fixed, let me 1 week please (need snapshot btw) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau
2014-02-07 Mark Struberg <[email protected]>: > -1 for this commit, this will most probably break all EAR or other > ClassLoader hierarchy scenarios. > please revert! > > The reason for taking the bean classloader is that this is the only > classloader which guarantees perfect visibility. > what if we have to create a bean in a shared EAR lib folder? If we would use > the TCCL, then the created proxy class would get registered in a random > WebAppClassLoader, right? And this would cause NoClassDefFound if the > @ApplicationScoped contextual instance would get accessed from another webapp. > Do you agree on this? > > We've had a long discussion on this already... > OSGi is in general broken in regards to classloading. I see no reason why we > should break sane scenarios for it. > > LieGrue, > strub > > > > > > On Friday, 7 February 2014, 20:58, "[email protected]" > <[email protected]> wrote: > > Author: rmannibucau >>Date: Fri Feb 7 19:58:32 2014 >>New Revision: 1565779 >> >>URL: http://svn.apache.org/r1565779 >>Log: >>OWB-931 using tccl first in normal scope proxy factory - to port to trunk >>when validated against tomee >> >>Modified: >> >> openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java >> >>Modified: >>openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java >>URL: >>http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java?rev=1565779&r1=1565778&r2=1565779&view=diff >>============================================================================== >>--- >>openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java >> (original) >>+++ >>openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java >> Fri Feb 7 19:58:32 2014 >>@@ -115,18 +115,17 @@ public class NormalScopeProxyFactory ext >> >> public <T> T createNormalScopeProxy(Bean<T> bean) >> { >>- final ClassLoader classLoader; >>- if (bean.getBeanClass() != null) >>+ ClassLoader classLoader = WebBeansUtil.getCurrentClassLoader(); >>+ if (classLoader == null) >> { >>- classLoader = bean.getBeanClass().getClassLoader(); >>- } >>- else if (OwbBean.class.isInstance(bean) && >>OwbBean.class.cast(bean).getReturnType() != null) >>- { >>- classLoader = >>OwbBean.class.cast(bean).getReturnType().getClassLoader(); >>- } >>- else >>- { >>- classLoader = WebBeansUtil.getCurrentClassLoader(); >>+ if (bean.getBeanClass() != null) >>+ { >>+ classLoader = bean.getBeanClass().getClassLoader(); >>+ } >>+ else if (OwbBean.class.isInstance(bean) && >>OwbBean.class.cast(bean).getReturnType() != null) >>+ { >>+ classLoader = >>OwbBean.class.cast(bean).getReturnType().getClassLoader(); >>+ } >> } >> >> Class<T> classToProxy; >> >> >> >> >>
