@Override protected URLClassLoader createUrlClassLoader( URL jarFileUrl, ClassLoader classLoader ) { return new KettleURLClassLoader( new URL[]{ jarFileUrl }, classLoader ); }
private KettleURLClassLoader createClassLoader( PluginInterface plugin ) throws MalformedURLException, UnsupportedEncodingException { List<String> jarFiles = plugin.getLibraries(); URL[] urls = new URL[jarFiles.size()]; for ( int i = 0; i < jarFiles.size(); i++ ) { File jarfile = new File( jarFiles.get( i ) ); urls[i] = new URL( URLDecoder.decode( jarfile.toURI().toURL().toString(), "UTF-8" ) ); } ClassLoader classLoader = getClass().getClassLoader(); String[] patterns = parentClassloaderPatternMap.get( plugin ); if ( patterns != null ) { return new KettleSelectiveParentFirstClassLoader( urls, classLoader, plugin.getDescription(), patterns ); } else { return new KettleURLClassLoader( urls, classLoader, plugin.getDescription() ); } }
private static Class<?> LoadAdditionalClass( String strJar, String strClassName ) throws KettleException { try { Thread t = Thread.currentThread(); ClassLoader cl = t.getContextClassLoader(); URL u = new URL( "jar:file:" + strJar + "!/" ); // We never know what else the script wants to load with the class loader, so lets not close it just like that. @SuppressWarnings( "resource" ) KettleURLClassLoader kl = new KettleURLClassLoader( new URL[] { u }, cl ); Class<?> toRun = kl.loadClass( strClassName ); return toRun; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ScriptMeta.Exception.UnableToLoadAdditionalClass" ), e ); } }
private static Class<?> LoadAdditionalClass( String strJar, String strClassName ) throws KettleException { try { Thread t = Thread.currentThread(); ClassLoader cl = t.getContextClassLoader(); URL u = new URL( "jar:file:" + strJar + "!/" ); // We never know what else the script wants to load with the class loader, so lets not close it just like that. @SuppressWarnings( "resource" ) KettleURLClassLoader kl = new KettleURLClassLoader( new URL[] { u }, cl ); Class<?> toRun = kl.loadClass( strClassName ); return toRun; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ScriptValuesMetaMod.Exception.UnableToLoadAdditionalClass" ), e ); } }
return new KettleURLClassLoader( urls.toArray( new URL[urls.size()] ), classLoader );
classLoader = new KettleURLClassLoader( jarFiles, getClass().getClassLoader() );
if ( classloader == null ) { classloader = new KettleURLClassLoader( urls, HadoopConfigurationBootstrap.getHadoopConfigurationProvider() .getActiveConfiguration().getHadoopShim().getClass().getClassLoader() ); classLoaderMap.put( librarySet, classloader );