private static List getUrlClassLoaderClasspathComponents ( URLClassLoader ucl ) { List components = new ArrayList ( ) ; URL [ ] urls = new URL [ 0 ] ; // Workaround for running on JBoss with UnifiedClassLoader3 usage // We need to invoke getClasspath() method instead of getURLs() if ( ucl . getClass ( ) . getName ( ) . equals ( "org.jboss.mx.loading.UnifiedClassLoader3" ) ) { try { Method classPathMethod = ucl . getClass ( ) . getMethod ( "getClasspath" , new Class [ ] { } ) ; urls = ( URL [ ] ) classPathMethod . invoke ( ucl , new Object [ 0 ] ) ; } catch ( Exception e ) { LogFactory . getLog ( ClasspathUtils . class ) . debug ( "Error invoking getClasspath on UnifiedClassLoader3: " , e ) ; } } else { // Use regular ClassLoader method to get classpath urls = ucl . getURLs ( ) ; } for ( int i = 0 ; i < urls . length ; i ++ ) { URL url = urls [ i ] ; components . add ( getCanonicalPath ( url . getPath ( ) ) ) ; } return components ; }
Get the list of classpath components