commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Billy Bacon" <billy.ba...@gmail.com>
Subject Re: how to use XML Configuration of Jakarta Commons in a servlet?
Date Sun, 12 Aug 2007 12:04:44 GMT
If you want to use the below code as is, you will need to put the
config.xml in the same package (directory) as the .java file which
contains the code below so the classloader can find it.

- Billy -


On 8/12/07, ying lcs <yinglcs@gmail.com> wrote:
> Hi,
>
> I am trying to use XMLConfiguration in my servlet like this:
>
> try {
> 			xmlconfig = new XMLConfiguration("config.xml");
> 		} catch (ConfigurationException  e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		}
>
> But it can't load the file 'config.xml'. Can you please tell me where
> should I put the config.xml file so that it can load it?
>
> org.apache.commons.configuration.ConfigurationException: Cannot locate
> configuration source config.xml
> 	at
> org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:213)
> 	at
> org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:193)
> 	at
> org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.load(AbstractHierarchicalFileConfiguration.java:163)
> 	at
> org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.<init>(AbstractHierarchicalFileConfiguration.java:90)
> 	at
> org.apache.commons.configuration.XMLConfiguration.<init>(XMLConfiguration.java:169)
> 	at  com.mytest.myservlet.ServletConfig.<clinit>(ServletConfig.java:39)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message