--- remoting-remoting-2.47.orig/src/main/java/hudson/remoting/UserRequest.java mié oct 29 15:37:14 2014 +++ remoting-remoting-2.47/src/main/java/hudson/remoting/UserRequest.java mié abr 13 19:19:41 2016 @@ -87,10 +87,32 @@ return result; } + static boolean workaroundDone = false; protected UserResponse perform(Channel channel) throws EXC { try { ClassLoader cl = channel.importedClassLoaders.get(classLoaderProxy); + // Allow forcibly load of a class, allows to workaround: + // @See https://issues.jenkins-ci.org/browse/JENKINS-19445 + // @Related https://issues.tmatesoft.com/issue/SGT-451 + final String clazz = System.getProperty(RemoteClassLoader.class.getName() + ".force", null); + if ( clazz != null && !workaroundDone) { + // java.lang classes can only be instantiated by the bootstrap Classloader. + // Guarantees that *all* threads with whatever Classloader in use, have the + // same mutex instance: an intance of java.lang.Class + synchronized(java.lang.Object.class) + { + workaroundDone = true; + try { + final Class loaded = Class.forName( clazz, true, cl ); + System.err.println("Loaded class: '" + clazz + "' using classloader: " + cl); + } catch (final ClassNotFoundException cnfe) { + // not big deal, print and swallow exception + System.err.println("Error finding class '" + clazz + "' using classloader: " + cl); + } + } + } + RSP r = null; Channel oldc = Channel.setCurrent(channel); try {