I have the same problem, this behavior is the same at least since JBoss AS 5.1.
Would be nice to have a solution for this annoying issue.
Currently this is the code that i'm calling to return the path:
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL url = loader.getResource(this.filename);
String path = url.getPath();
repos = new File(path);
You have done that partially right. You shouldn't be using the absolute file path while working in Java EE environment. Instead, what you (typically) need to do is:
InputStream is = classLoader.getResourceAsStream(filename);
// then use the inputstream for further processing.
How do you use the "repos" later on in your code?
Thanks jaikiran pai, it worked!
Basicallly we pass it to an FileInputStream and it reads in parameters in a xml file.
I'm not sure why its was written this way to be honest.