commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [configuration] Properties files in jars
Date Mon, 15 Nov 2004 15:40:52 GMT

do you work on Windows or on Unix? Which exception do you get when you 
ommit the leading slash?

I supose the correct form would be just the name of the properties file 
with a leading slash. But there seems to be a bug, so that such names 
are interpreted as absolute file names and then the classpath is not 
searched at all. I will have a closer look on that.


Grant Ingersoll wrote:

> 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)
>         {
>             configFact.setConfigurationURL(configURL);
>         }
> 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,
> Grant
>>>> 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.
> Oliver

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

View raw message