Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 58637 invoked from network); 14 Jan 2004 20:04:29 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 14 Jan 2004 20:04:29 -0000 Received: (qmail 22447 invoked by uid 500); 14 Jan 2004 20:04:14 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 22346 invoked by uid 500); 14 Jan 2004 20:04:13 -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 22331 invoked from network); 14 Jan 2004 20:04:13 -0000 Received: from unknown (HELO mail.creativesolutions.com) (198.51.241.250) by daedalus.apache.org with SMTP; 14 Jan 2004 20:04:13 -0000 Received: from dxmail01_dmz_nat.creativesol.com (dexmail01.creativesol.com) [10.223.196.24] by mail.creativesolutions.com with esmtp id 1AgrFR-0005AR-00; Wed, 14 Jan 2004 15:04:17 -0500 Received: by dexmail01.creativesol.com with Internet Mail Service (5.5.2657.72) id ; Wed, 14 Jan 2004 15:04:17 -0500 Message-ID: From: "Tong, Andrew" To: Jakarta Commons Users List Subject: RE: [Configuration] Hierarchical Configuration Problem: Newbie Date: Wed, 14 Jan 2004 15:04:16 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Although I've never used commons-configurations, the NoSuchMethodException leads me to believe that you need to have JDK 1.4 or higher. The docs say that the StringBuffer.indexOf(String) method was introduced in that version. http://java.sun.com/j2se/1.4.1/docs/api/java/lang/StringBuffer.html#indexOf( java.lang.String) -----Original Message----- From: Vikas Phonsa [mailto:VPhonsa@suz.com] Sent: Wednesday, January 14, 2004 2:32 PM To: 'commons-user@jakarta.apache.org' Subject: Hierarchical Configuration Problem: Newbie Hi Everybody, I am trying to learn the commons-configuration from the examples given on the website http://jakarta.apache.org/commons/configuration/examples.html Things were working as expected until I started to use the Hierarchical Properties. I'm listing my source code, the exceptions that I'm getting and the properties file that I'm using. I would appreciate any thoughts. Thanks Vikas ---------------Source Code---------------------------------- public class FirstConfig { public static void main(String[] args) throws Exception{ ConfigurationFactory configFactory = new ConfigurationFactory(); URL configFile = new File("config\\config.xml").toURL(); System.out.println("URL== "+ configFile); configFactory.setConfigurationURL(configFile); Configuration config = configFactory.getConfiguration(); String backgroundColor = config.getString("color.background"); String textColor = config.getString("color.text"); String rows = config.getString("rowsPerPage"); System.out.println("Here is the back ground color property: "+ backgroundColor); System.out.println("Here is the text color property: "+ textColor); System.out.println("Here is the rows per page property: "+ rows); //Everything is working perfectly fine till here Object tablename = config.getProperty("tables.table(0).name"); System.out.println("Here is tablename.toString() : "+tablename.toString()); } } --------------Exception Stack Trace---------------------------------------- URL== file:/c:/wsad_workspaces/Eclipse/Commons-Config/config/config.xml Here is the back ground color property: black; Here is the text color property: #000000 Here is the rows per page property: 15 java.lang.NoSuchMethodError: java.lang.StringBuffer: method indexOf(Ljava/lang/String;I)I not found at org.apache.commons.configuration.ConfigurationKey$KeyIterator.findNextIndice s(ConfigurationKey.java:431) at org.apache.commons.configuration.ConfigurationKey$KeyIterator.nextKey(Config urationKey.java:472) at org.apache.commons.configuration.HierarchicalConfiguration.findPropertyNodes (HierarchicalConfiguration.java:476) at org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(Hie rarchicalConfiguration.java:449) at org.apache.commons.configuration.HierarchicalConfiguration.getPropertyDirect (HierarchicalConfiguration.java:188) at org.apache.commons.configuration.HierarchicalConfiguration.containsKey(Hiera rchicalConfiguration.java:354) at org.apache.commons.configuration.CompositeConfiguration.getFirstMatchingConf ig(CompositeConfiguration.java:753) at org.apache.commons.configuration.CompositeConfiguration.getProperty(Composit eConfiguration.java:220) at com.suz.config.first.FirstConfig.main(FirstConfig.java:58) Exception in thread "main" --------------------config.xml------------------------- ---------------------tables.xml---------------------- ?xml version="1.0" encoding="ISO-8859-1" ?> users uid long uname java.lang.String firstName java.lang.String lastName java.lang.String email java.lang.String
documents docid long name java.lang.String creationDate java.util.Date authorID long version int
--------------------------------------------------------------------- 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