-
1. Re: JBOSS 6: Exploded War - path not found
esimioni Sep 14, 2011 12:40 PM (in response to oakleyx)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.
Cheers,
Eduardo.
-
2. Re: JBOSS 6: Exploded War - path not found
oakleyx Sep 27, 2011 1:17 PM (in response to esimioni)I agree.
-
3. Re: JBOSS 6: Exploded War - path not found
jaikiran Sep 28, 2011 3:14 AM (in response to oakleyx)oakleyx wrote:
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?
-
4. Re: JBOSS 6: Exploded War - path not found
oakleyx Sep 29, 2011 8:56 AM (in response to jaikiran)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.
Thanks Again!
-Dan