commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Mansion <>
Subject problems with configuration
Date Sat, 04 Aug 2007 15:12:22 GMT
Using configuration 1.4, XP, SunJVM 1.5.0_12

I'm trying to use configuration as a  newbie.

I have in my code:

    DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder() ;
    builder.setURL(getClass().getResource("standard-config.xml")) ;
    HierarchicalConfiguration cfg =
builder.configurationAt("processor-bean") ;

This fails with:

    java.lang.IllegalArgumentException: Passed in key must select
exactly one node: processor-bean

The standard-config.xml is:

    <!--Load the optional specified config file-->
    <xml fileName="standard-processor.xml" optional="true">

and standard-processor.xml is:

    <processor-bean config-class="com.msgware.mwdoc.Processor"
       <fileLoader config-class="com.msgware.mwdoc.FileLoader">

Unfortunately the fetchNodeList returns nothing.

If of the configurationAt instead I go:

            Configuration tmp = builder.getConfiguration() ;

            Iterator i = tmp.getKeys() ;

            while (i.hasNext())
                System.out.println("Got key: " ;

Then I get broadly what I had expected:

Got key: processor-bean.fileLoader[@config-class]
Got key: processor-bean.blockInferenceEngine[@config-class]
Got key: processor-bean[@config-class]
Got key: processor-bean[@verbose]

What am I doing wrong?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message