Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 34672 invoked from network); 16 Nov 2004 13:49:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Nov 2004 13:49:08 -0000 Received: (qmail 72269 invoked by uid 500); 16 Nov 2004 13:49:01 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 72224 invoked by uid 500); 16 Nov 2004 13:49:01 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 72207 invoked by uid 99); 16 Nov 2004 13:49:00 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [128.230.248.25] (HELO gwia201.syr.edu) (128.230.248.25) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 16 Nov 2004 05:48:57 -0800 Received: from MTA2-MTA by gwia201.syr.edu with Novell_GroupWise; Tue, 16 Nov 2004 08:48:51 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.1 Date: Tue, 16 Nov 2004 08:48:41 -0500 From: "Grant Ingersoll" To: Subject: Re: [configuration] Properties files in jars Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I am on Windows, but have seen the same on OS X. The exceptions for the two different ways of specifying are below. Sorry for the large stack traces. Without the slash (), the error is slightly different, namely: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:258) at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:505) at org.apache.commons.digester.Rule.end(Rule.java:276) at org.apache.commons.digester.Digester.endElement(Digester.java:1058) 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) at org.cnlp.utils.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:52) at org.cnlp.utils.properties.PropertyHolder.loadProperties(PropertyHolder.java:246) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver.(TaxonomyViewDriver.java:59) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver$TaxonomyRunnable.run(TaxonomyViewDriver.java:112) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Caused by: org.apache.commons.configuration.ConfigurationException: C:\ENG\Projects\AuthoringToolkit\conf\command.properties (The system cannot find the file specified) at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:128) at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:63) ... 30 more Caused by: java.io.FileNotFoundException: C:\ENG\Projects\AuthoringToolkit\conf\command.properties (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:106) at java.io.FileInputStream.(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156) at java.net.URL.openStream(URL.java:913) at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:123) ... 31 more 32 ERROR configuration.ConfigurationFactory - SAX Exception caught org.apache.commons.configuration.ConfigurationException: C:\ENG\Projects\AuthoringToolkit\conf\command.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) at org.cnlp.utils.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:52) at org.cnlp.utils.properties.PropertyHolder.loadProperties(PropertyHolder.java:246) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver.(TaxonomyViewDriver.java:59) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver$TaxonomyRunnable.run(TaxonomyViewDriver.java:112) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) org.apache.commons.configuration.ConfigurationException: SAX Exception caught at org.apache.commons.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:163) at org.cnlp.utils.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:52) at org.cnlp.utils.properties.PropertyHolder.loadProperties(PropertyHolder.java:246) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver.(TaxonomyViewDriver.java:59) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver$TaxonomyRunnable.run(TaxonomyViewDriver.java:112) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Caused by: org.apache.commons.configuration.ConfigurationException: C:\ENG\Projects\AuthoringToolkit\conf\command.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) --------------------------------------------- Here is what I get with the slash (): java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:258) at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:505) at org.apache.commons.digester.Rule.end(Rule.java:276) at org.apache.commons.digester.Digester.endElement(Digester.java:1058) 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) at org.cnlp.utils.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:52) at org.cnlp.utils.properties.PropertyHolder.loadProperties(PropertyHolder.java:246) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver.(TaxonomyViewDriver.java:59) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver$TaxonomyRunnable.run(TaxonomyViewDriver.java:112) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Caused by: org.apache.commons.configuration.ConfigurationException: \command.properties (The system cannot find the file specified) at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:128) at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:63) ... 30 more Caused by: java.io.FileNotFoundException: \command.properties (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:106) at java.io.FileInputStream.(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156) at java.net.URL.openStream(URL.java:913) at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:123) ... 31 more 63 ERROR configuration.ConfigurationFactory - SAX Exception caught org.apache.commons.configuration.ConfigurationException: \command.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) at org.cnlp.utils.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:52) at org.cnlp.utils.properties.PropertyHolder.loadProperties(PropertyHolder.java:246) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver.(TaxonomyViewDriver.java:59) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver$TaxonomyRunnable.run(TaxonomyViewDriver.java:112) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) org.apache.commons.configuration.ConfigurationException: SAX Exception caught at org.apache.commons.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:163) at org.cnlp.utils.configuration.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:52) at org.cnlp.utils.properties.PropertyHolder.loadProperties(PropertyHolder.java:246) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver.(TaxonomyViewDriver.java:59) at org.cnlp.authoring.taxonomy.view.swing.TaxonomyViewDriver$TaxonomyRunnable.run(TaxonomyViewDriver.java:112) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Caused by: org.apache.commons.configuration.ConfigurationException: \command.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) >>> hegero@med.uni-marburg.de 11/15/2004 10:40:52 AM >>> 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 > > >>>>hegero@med.uni-marburg.de 11/12/2004 9:35:00 AM >>> > > ConfigurationFactory can load property files from classpath. Did you try > > ? > > 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: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org