[ https://issues.apache.org/jira/browse/YOKO-258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491987 ]
Sergey Salishev commented on YOKO-258: -------------------------------------- Didn't found a way to attach the file so just pasting my changes to the fix Index: rmi-impl/src/main/java/org/apache/yoko/rmi/util/ClassLoaderLocal.java =================================================================== --- rmi-impl/src/main/java/org/apache/yoko/rmi/util/ClassLoaderLocal.java (revision 532714) +++ rmi-impl/src/main/java/org/apache/yoko/rmi/util/ClassLoaderLocal.java (working copy) @@ -86,21 +86,29 @@ // table for tracking the CL to map relationships. We're // using a WeakHashMap to prevent us pinning class loaders. - static private WeakHashMap localMaps = new WeakHashMap(); + static final private WeakHashMap localMaps = new WeakHashMap(); + static final private ThreadLocal threadLocalMap = new ThreadLocal(); + + static { + localMaps.put(null, globalMap); + } + private ClassLocalMap getLoaderLocalMap() { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); + ClassLocalMap map = (ClassLocalMap) threadLocalMap.get(); - ClassLocalMap map; - if (cl == null) { - map = globalMap; - } else { - // create a local map and store in our tracking table. - map = (ClassLocalMap)localMaps.get(cl); - if (map == null) { - map = new ClassLocalMap(); - localMaps.put(cl, map); + if (map == null) { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + + synchronized (localMaps) { + // create a local map and store in our tracking table. + map = (ClassLocalMap)localMaps.get(cl); + if (map == null) { + map = new ClassLocalMap(); + localMaps.put(cl, map); + } } + threadLocalMap.set(map); } return map; } > Bad reference to ClassLoader.classes in > org.apache.yoko.rmi.util.ClassLoaderLocal static initializer > ---------------------------------------------------------------------------------------------------- > > Key: YOKO-258 > URL: https://issues.apache.org/jira/browse/YOKO-258 > Project: Yoko - CORBA Server > Issue Type: Bug > Reporter: Vasily Zakharov > Assigned To: Lars Kühne > Fix For: v1.0.0 > > > org.apache.yoko.rmi.util.ClassLoaderLocal class contains the following line > in its static initializer: > classes_vector = ClassLoader.class.getDeclaredField("classes"); > This line references the 'classes' field in class java.lang.ClassLoader, and > that field is not documented by API JavaDoc and may be absent in particular > Java VM/classlib implementations, for example it's absent in Apache Harmony. > As the result of this issue, the classes > org.apache.yoko.rmi.util.ClassLoaderLocal and > org.apache.yoko.rmi.impl.PortableRemoteObjectExtImpl fail to load with > NoSuchFieldException, on those implementations. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.