URLs resolve differently against directory base URLS vs a jar file. Without the details of what is being done that does not work I can't say more than look into this.
As it turns out, rewriting the code was a better option than manually exploding the .sar file each time, so that is what we did. The underlying code was using
classLoader.getResource(filename)which we were able to change to
The first call gets a URL, and the second an Input Stream. When the first bit of code is called with "bar.xml", it fails while looking for: C:\jboss-4.0.1sp1\server\default\tmp\deploy\tmp20951foo.sar-contents\bar.xml It can't find the file, because it is not unpacked into the temp directory..
The second one finds the file, without looking in the temporary directory, by getting it directly from foo.sar.
I still don't know why the .ear file is fully exploded into it's temporary directory, and the .sar file is only partially exploded (only .jar files.)