commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <>
Subject Re: [Configuration] load config files from ddifferent jars
Date Mon, 09 Aug 2004 20:11:48 GMT
Hallo Oliver,
Thanks for your response.

I tested this on Windoze 2000 but the application will eventually run on
Linux. But this shouldn't come into it as the properties file resides in
another jar file (see example below).
The jar containing the properties file is called biz.jar and the
properties file is in the root package "biz". Hence I tried to refer to
the prop file as "/biz/". The jar containing the
composite config .xml is called app.jar. Both jar files are in the
classpath of the application.

I certainly do not want to have to specify the other jar file using an
absolute file name.

I got the following exception which shows that the ConfigurationFactory
is trying to load biz/properties, i.e. a file in the same jar as the
composite config .xml.

Here's a stack trace snippet.

Caused by: org.apache.commons.configuration.ConfigurationException:
Could not load from file /biz/
	... 19 more
Caused by: JAR entry biz/
not found in K:\Projects\Ffordes\development\ffordes_0-2\build\dist\app.jar


Oliver Heger wrote:
> ConfigurationFactory should work with both relative and absolute file 
> names (at least this is the theory ;-) You should also be able to pass 
> in a complete URL.
> Which operating system are you working on? If it is Unix/Linux, your 
> configuration file shouldn't make problems (unless there is a bug in the 
> methods for loading the configurations). Under Windows you will have to 
> provide a filename like C:\mydir\ You can also 
> try to specify a file:/ URL pointing to your properties file.
> T E Schmitz wrote:
>> Hello,
>> I would like to set up a configuration factory specifying a properties 
>> file which does not reside in the same jar as the composite 
>> configuration .xml file.
>> Example:
>> <configuration>
>>     <properties fileName=""/>
>>     <properties fileName="/biz/"/>
>>     <hierarchicalDom4j fileName="objects/business-objects.xml"/>
>> </configuration>
>> It appears that the leading slash is stripped and an attempt is made 
>> to read biz/ from the .jar file where above .xml config 
>> resides.
>> Is there a way of loading the various config files from different .jar 
>> files?

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

View raw message