Grant,
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.
Oliver
Grant Ingersoll wrote:
I have tried that, I get:
16 ERROR configuration.ConfigurationFactory - SAX Exception caught org.apache.commons.configuration.ConfigurationException: \my.properties (The system cannot find the file specified) at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540) at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566) at org.apache.commons.digester.Digester.endElement(Digester.java:1061) 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 Source) 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(Digester.java:1567) at org.apache.commons.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:157)
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 my.properties. 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
[EMAIL PROTECTED] 11/12/2004 9:35:00 AM >>>
ConfigurationFactory can load property files from classpath. Did you try
<properties fileName="/my.properties"/> ?
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.
HTH Oliver
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
