felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (FELIX-962) Erroneous class loading delegation to the application launcher classloader in some cases
Date Thu, 12 Mar 2009 19:02:50 GMT

    [ https://issues.apache.org/jira/browse/FELIX-962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681449#action_12681449
] 

Guillaume Nodet edited comment on FELIX-962 at 3/12/09 12:01 PM:
-----------------------------------------------------------------

Your patch does not work because it calls 
   clazz.getMethod("getEnclosingClass")
instead of
   Class.class.getMethod("getEnclosingClass")

The attached patch fix this issue and works great for me.
I've also slightly modified the patch to cache the method.

      was (Author: gnt):
    Your patch does work because it calls 
   clazz.getMethod("getEnclosingClass")
instead of
   Class.class.getMethod("getEnclosingClass")

The attached patch fix this issue and works great for me.
I've also slightly modified the patch to cache the method.
  
> Erroneous class loading delegation to the application launcher classloader in some cases
> ----------------------------------------------------------------------------------------
>
>                 Key: FELIX-962
>                 URL: https://issues.apache.org/jira/browse/FELIX-962
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>            Reporter: Guillaume Nodet
>            Assignee: Richard S. Hall
>            Priority: Critical
>             Fix For: felix-1.6.0
>
>         Attachments: FELIX-962-bis.patch, FELIX-962-newerer.patch, FELIX-962-quarter.patch,
FELIX-962-quinquies.patch, FELIX-962-richard.txt, FELIX-962-septies.patch, FELIX-962-sexies.patch,
FELIX-962-ter.patch, FELIX-962.new.patch, FELIX-962.newer.patch, FELIX-962.patch
>
>
> Here is an example stack trace:
> {code}
> ProcessStoreImpl-1@50 daemon, priority=5, in group 'main', status: 'RUNNING'
> 	  at org.apache.felix.framework.searchpolicy.ModuleImpl.searchDynamicImports(ModuleImpl.java:1,215)
> 	  at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:558)
> 	  at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
> 	  at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1,382)
> 	  at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> 	  at org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:428)
> 	  at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1,341)
> 	  at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:737)
> 	  at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
> 	  at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
> 	  at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> 	  at org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:184)
> 	  at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> 	  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
> 	  at java.lang.ClassLoader.defineClass1(ClassLoader.java:-1)
> 	  at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
> 	  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> 	  at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> 	  at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> 	  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> 	  at java.security.AccessController.doPrivileged(AccessController.java:-1)
> 	  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> 	  at org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:200)
> 	  at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> 	  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
> 	  at org.apache.openjpa.util.ProxyMaps.afterEntrySet(ProxyMaps.java:74)
> 	  at org.apache.openjpa.util.java$util$HashMap$proxy.entrySet(Unknown Source:-1)
> 	  at org.apache.openjpa.util.ProxyMaps.values(ProxyMaps.java:65)
> 	  at org.apache.openjpa.util.java$util$HashMap$proxy.values(Unknown Source:-1)
> 	  at org.apache.openjpa.kernel.SingleFieldManager.delete(SingleFieldManager.java:335)
> 	  at org.apache.openjpa.kernel.SingleFieldManager.delete(SingleFieldManager.java:283)
> 	  at org.apache.openjpa.kernel.StateManagerImpl.cascadeDelete(StateManagerImpl.java:2,861)
> 	  at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2,566)
> 	  at org.apache.openjpa.kernel.SingleFieldManager.delete(SingleFieldManager.java:387)
> 	  at org.apache.openjpa.kernel.SingleFieldManager.delete(SingleFieldManager.java:372)
> 	  at org.apache.openjpa.kernel.SingleFieldManager.delete(SingleFieldManager.java:329)
> 	  at org.apache.openjpa.kernel.SingleFieldManager.delete(SingleFieldManager.java:283)
> 	  at org.apache.openjpa.kernel.StateManagerImpl.cascadeDelete(StateManagerImpl.java:2,861)
> 	  at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2,566)
> 	  at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2,531)
> 	  at org.apache.openjpa.kernel.DelegatingBroker.delete(DelegatingBroker.java:1,046)
> 	  at org.apache.openjpa.persistence.EntityManagerImpl.remove(EntityManagerImpl.java:659)
> 	  at org.apache.ode.store.jpa.JpaObj.delete(JpaObj.java:34)
> 	  at org.apache.ode.store.jpa.DeploymentUnitDaoImpl.delete(DeploymentUnitDaoImpl.java:114)
> 	  at org.apache.ode.store.ProcessStoreImpl$3.call(ProcessStoreImpl.java:303)
> 	  at org.apache.ode.store.ProcessStoreImpl$3.call(ProcessStoreImpl.java:300)
> 	  at org.apache.ode.store.ProcessStoreImpl$Callable.call(ProcessStoreImpl.java:701)
> 	  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
> 	  at java.util.concurrent.FutureTask.run(FutureTask.java:123)
> 	  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	  at java.lang.Thread.run(Thread.java:613)
> {code}
> The interesting bit is the following exerpt:
> {code}
> 	  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> 	  at java.security.AccessController.doPrivileged(AccessController.java:-1)
> 	  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> {code}
> The current code in ModuleImpl#searchDynamicImports() does not really handle this case.
 The reason is that the {{java.net.URLClassLoader$1}} class is an anonymous PrivilegedExceptionAction.
> The result is that the loop is aborted too soon and the launcher classloader is used
to delegate the call.   In my application, it leads to all kinds of LinkageError being thrown.
> Note that this problem mostly happen on macs, which has a weird thing in the classloader,
trying to handle some org.apache.crimson / org.apache.xalan / org.apache.xml / org.apache.xpath
in some weird way.
> Anyway, I have a patch to support this anonymous classes I will attach now.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message