Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 13594 invoked from network); 15 Mar 2005 13:02:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 15 Mar 2005 13:02:58 -0000 Received: (qmail 41101 invoked by uid 500); 15 Mar 2005 13:02:53 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 41038 invoked by uid 500); 15 Mar 2005 13:02:53 -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 41014 invoked by uid 99); 15 Mar 2005 13:02:52 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_60_70,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mx1.adesso.de (HELO mx1.adesso.de) (195.138.52.15) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 15 Mar 2005 05:02:51 -0800 Received: from localhost (localhost [127.0.0.1]) by mx1.adesso.de (Postfix) with ESMTP id 7B415A662 for ; Tue, 15 Mar 2005 14:02:38 +0100 (CET) Received: from mx1.adesso.de ([127.0.0.1]) by localhost (mx1.adesso.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07727-04 for ; Tue, 15 Mar 2005 14:02:38 +0100 (CET) Received: from lotus-ext.adesso.de (mail.adesso.de [172.20.20.5]) by mx1.adesso.de (Postfix) with ESMTP id 063ADA3EE for ; Tue, 15 Mar 2005 14:02:38 +0100 (CET) To: commons-user@jakarta.apache.org Subject: Problem with commons configuration MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 Message-ID: From: Stefan Aigner Date: Tue, 15 Mar 2005 14:02:36 +0100 X-MIMETrack: Serialize by Router on lotus-ext/Adesso/DE(Release 6.5.2|June 01, 2004) at 03/15/2005 14:02:37, Serialize complete at 03/15/2005 14:02:37 Content-Type: multipart/alternative; boundary="=_alternative 0047E016C1256FC5_=" X-Virus-Scanned: by amavisd-new at adesso.de X-Spam-Checker-Version: SpamAssassin 3.0.0-5 (2004-09-13) on mx1.adesso.de X-Spam-Level: X-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,HTML_60_70, HTML_MESSAGE autolearn=failed version=3.0.0-5 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --=_alternative 0047E016C1256FC5_= Content-Type: text/plain; charset="US-ASCII" Hello all, I have a problem with commons configuration. My setting is as follows: I use the jar commons-configuration-1.0-rc2.jar. My config files are as follows: File config.xml: File my-properties.xml: ... ... ... ... Both config files are in the classpath. Code to load the Configuration: ConfigurationFactory factory = new ConfigurationFactory("config.xml"); org.apache.commons.configuration.Configuration commonsConfig = null; try { commonsConfig = factory.getConfiguration(); } catch (ConfigurationException e) { ... } The following code works fine: String serviceClassName = config.getString("service-configuration.service[@className]"); String serviceConfig = config.getString("service-configuration.service.service-config"); String serviceFactory = config.getString("service-configuration.service.service-factory"); After executing this code, the three variables above contain the appropriate String values from the first 'service' element in the my-properties.xml file. Now, when I execute the following code to get a property from the second 'service' element as described in the documentation, the value of the String 'serviceConfigName' is null. String serviceConfigName = (String) commonsConfig.getProperty("service-configuration.service(1).service-config"); What am I doing wrong here? Any suggestions are highly appreciated. Stefan _________________________________________________ Stefan Aigner . adesso AG . Ehrenbergstrasse 20 . 10245 Berlin tel.: +49-30-7262033-42 mobil: +49-178-2808102 fax: +49-30-7262033-99 email: aigner@adesso.de http://www.adesso.de _______________________________________________________ --=_alternative 0047E016C1256FC5_=--