commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Aigner <>
Subject Problem with commons configuration
Date Tue, 15 Mar 2005 13:02:36 GMT
Hello all,

I have a problem with commons configuration. My setting is as follows:

I use the jar commons-configuration-1.0-rc2.jar.

My config files are as follows:

File config.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>

    <xml fileName="my-properties.xml" />

File my-properties.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>


                <service className="...">

                <service className="...">


Both config files are in the classpath.

Code to load the Configuration:

        ConfigurationFactory factory = 
            new ConfigurationFactory("config.xml");
        org.apache.commons.configuration.Configuration commonsConfig = 
        try {
            commonsConfig = factory.getConfiguration();
        } catch (ConfigurationException e) {

The following code works fine:

        String serviceClassName = 
        String serviceConfig = 
        String serviceFactory = 

After executing this code, the three variables above contain the 
appropriate String values from the first 'service' element in the 
my-properties.xml file.

Now, when I execute the following code to get a property from the second 
'service' element as described in the documentation, the value of the 
String 'serviceConfigName' is null.

        String serviceConfigName = (String)

What am I doing wrong here?

Any suggestions are highly appreciated.


Stefan Aigner . adesso AG . Ehrenbergstrasse 20 . 10245 Berlin

tel.:  +49-30-7262033-42     mobil:  +49-178-2808102
fax:  +49-30-7262033-99     email:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message