If you try to Hibernate (as of 2.1.4) with jar-file based mapping files as part of an Ant task, you will not be able to find the mapping jar file (unless it is added to the Ant classpath rather than the task class path). The problem is easily fixed with the following modification to Configuration.addJar (which mimics some of the addResource changes in 2.1.3 ff).
Code:
/**
* Read all mappings from a jar file
* @param resource an application resource (a jar file)
* @deprecated use <tt>addJar(java.io.File)</tt>
*/
public Configuration addJar(String resource) throws MappingException {
URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
if (url == null) url = Environment.class.getClassLoader().getResource(resource);
if (url == null) throw new MappingException( "Jar file: " + resource + " not found" );
return addJar( new File( url.getFile() ));
}
This might effect other delegated classloader environments, not sure.