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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]