When you install tomcat using as a service [windows setup file installation] it runs from system32 directory. but when you extract the zip file and run the catalina.bat it starts from tomcat/bin where the bat file is available.
One solution can be to place this .xml file in tomcat/shared/classes directory so that its always available to you, but its available to all web applications! and the deployment script should handle placing it to the shared/classes directory.
Another solution could be to load the xml file content as streams using getClass().getClassLoader().getResourceAsStream() method. this getResourceAsStream() takes file name as parameter, and the path will the relative to the Class you are using to get the resource.
For example
Code:
Class Test {
public void testMethod(Class class) {
// if abc.txt is available in the same directory as Test.class
// can give relative path here
InputStream in = class.getClassLoader().getResourceAsStream("abc.txt");
}
public static void main(String[] args) {
Test o = new Test();
o.testMethod(Test.class);
}
}
I've not compiled this code, just wrote it while replying, but thats a way to load resources.
Hope it helps :-)