I'm looking at this legacy piece of code
/** * Scan the current context's classloader to locate any potential sources of Hibernate mapping files. * * @throws DeploymentException */ private void scanForMappings() throws DeploymentException { // Won't this cause problems if start() is called from say the console? // a way around is to locate our DeploymentInfo and grab its ucl attribute // for use here. URL[] urls; ClassLoader cl = Thread.currentThread().getContextClassLoader(); if ( cl instanceof RepositoryClassLoader ) { urls = ( ( RepositoryClassLoader ) cl ).getClasspath(); } else if ( cl instanceof URLClassLoader ) { urls = ( ( URLClassLoader ) cl ).getURLs(); } else { throw new DeploymentException( "Unable to determine urls from classloader [" + cl + "]" ); } // Search the urls for each of the classpath entries for any containing // hibernate mapping files VirtualFileVisitor visitor = new HibernateMappingVisitor(classpathUrls); // visit har url if set if (harUrl != null) visitURL(harUrl, visitor); // visit CL urls for ( int j = 0; j < urls.length; j++ ) { final URL entry = urls[j]; visitURL(entry, visitor); } log.trace("Found mappings: " + classpathUrls); }