java "File not found" when using commons-configuration XMLConfiguration with Tomcat

Posted by Bruno Shine on Stack Overflow See other posts from Stack Overflow or by Bruno Shine
Published on 2010-12-23T15:47:54Z Indexed on 2010/12/23 22:54 UTC
Read the original article Hit count: 383

Hi all, I'm building two apps that uses commons-configuration XMLConfiguration. Since the apps are related, I've build another project, called commons, that has a custom configuration manager that initializes the XMLConfiguration like so:

config = new XMLConfiguration("conf/config.xml");

What happens is that the "command-line" app works fine, loading the configuration file. But when I try to use my custom configuration manager on a webapp (using tomcat) I get a "org.apache.commons.configuration.ConfigurationException: Cannot locate configuration source".

I've placed the conf directory on the WEB-INF folder, the root folder and the META-INF folder. I've also tried with "/conf/config.xml", "./conf/config.xml" and "../conf/config.xml".

The only time I got this to work - on the web app - was using a absolute path.

What am I missing?

Thanks, Bruno

© Stack Overflow or respective owner

Related posts about java

Related posts about tomcat