commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grant Ingersoll" <>
Subject Re: [configuration] Properties files in jars
Date Fri, 12 Nov 2004 17:41:10 GMT
I have tried that, I get:

16   ERROR configuration.ConfigurationFactory  - SAX Exception caught
org.apache.commons.configuration.ConfigurationException: \ (The system cannot
find the file specified)
	at org.apache.commons.digester.Digester.createSAXException(
	at org.apache.commons.digester.Digester.createSAXException(
	at org.apache.commons.digester.Digester.endElement(
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.commons.digester.Digester.parse(
	at org.apache.commons.configuration.ConfigurationFactory.getConfiguration(

Have also tried it w/o the leading slash.

My ConfigurationFactory initialization is:
URL configURL = getClass().getResource("/config.xml");
        if (configURL != null)

The config.xml file does not live in the same JAR as the  Is this a ClassLoader
issue?  That is, does it not find it b/c there are actually two separate class loaders involved?
 Doesn't seem like that should be the issue, as Java is finding classes located in the JAR
in question.

Thanks for your help,

>>> 11/12/2004 9:35:00 AM >>>
ConfigurationFactory can load property files from classpath. Did you try

   <properties fileName="/"/>  ?

A couple of steps are performed to resolve the file: It is checked 
whether a full URL or an absolute or relative file name are provided. If 
this fails, the classpath is searched for the specified file.


Grant Ingersoll wrote:

> Hi,
> I am using the commons-configuration-1.0.  I would like to specify a
> property file located in a JAR file.  The following property declaration
> _does_  work:
> <properties
> fileName="jar:file:///c:/myPath/myJar.jar!/"/>
> However, I would like to specify a relative path to the JAR file
> instead of a full path (as other developers on the project may not have
> the file in the same path).  I have tried a variety of combinations, but
> none seem to work.  
> Can anyone shed some light on this?  Is it possible to specify a
> relative path for JAR files like this?  The JAR file is in the
> classpath, if that matters.
> Thanks,
> Grant Ingersoll
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> For additional commands, e-mail: 

Dipl.-Inform. Oliver Heger
Zentrale Informationsverarbeitung (ZIV) / Bereich Anwenderverfahren
Klinikum der Philipps-Universit├Ąt Marburg
D-35037 Marburg
Tel: +49 6421 28-66923 

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

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

View raw message