commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [Configuration] Problem with combining two xml-files
Date Thu, 26 Jun 2008 20:02:16 GMT
Michael Post schrieb:
> Hello,
> i use the current version (1.5) of commons configuration for my project
> with commons-beanutils-1.7.0.jar, commons-chain-1.2.jar,
> commons-codec-1.3.jar, commons-collections-3.2.1.jar,
> commons-digester-1.8.jar, commons-jxpath-1.2.jar, commons-lang-2.4.jar
> und commons-logging-1.1.1.jar.
> I want to read combine the two xml configuration files to one and later
> i want to read some properties of it.
> Like the tutorial on
> i programmed my small plain Java application ( in which
> i read both configurations like the tutorial. Some lines later i read
> some properties of the configuration but all values are null.
> I can not understand why / what is wrong.
> Thanks for supporting me,
> Michael

The code for creating the combined configuration seems to be alright. I 
assume the problem lies in your usage of the getProperties() method, 
which probably does not what you expect. Have a look at the Javadocs for 
the Configuration interface.

I recommend that you try to read simple properties first using 
getString() or one of the other simple get() methods. I am not sure what 
you want to achieve with getProperties(). Maybe the configurationAt() 
method goes in this direction?

For debugging combined configurations you can use the following trick: 
Copy the content of the combined configuration into an XMLConfiguration:

CombinedConfiguration cc = ...
XMLConfiguration conf = new XMLConfiguration(cc);

Then the XMLConfiguration can be saved. The resulting XML file shows the 
structure of the combined configuration.


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

View raw message