Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 74228 invoked from network); 7 Apr 2005 01:32:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Apr 2005 01:32:31 -0000 Received: (qmail 34567 invoked by uid 500); 7 Apr 2005 01:32:27 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 34552 invoked by uid 500); 7 Apr 2005 01:32:27 -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 34539 invoked by uid 99); 7 Apr 2005 01:32:27 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of samad.haytham@gmail.com designates 64.233.184.195 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.195) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 06 Apr 2005 18:32:25 -0700 Received: by wproxy.gmail.com with SMTP id 71so419637wri for ; Wed, 06 Apr 2005 18:32:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding; b=QlypJSBH25Izdh7agLdxxBEBwR1O7a1iEg2L/GANSiY1eUpbGV37XByTZkasQK1q5miAvQJ8b5SxJJyEs03rDI+/au5gp3/o0c/y98Bcs6OxATNbvIxYmn8QWkLqZg+/gZo95qELK4akkm6nIrAjq9MdmvWfZQXbVzCJQ1KIS6U= Received: by 10.54.50.73 with SMTP id x73mr119016wrx; Wed, 06 Apr 2005 18:32:23 -0700 (PDT) Received: from ?192.168.0.104? ([64.81.136.228]) by mx.gmail.com with ESMTP id 8sm170738wrl.2005.04.06.18.32.23; Wed, 06 Apr 2005 18:32:23 -0700 (PDT) Message-ID: <42548DA4.5080006@gmail.com> Date: Wed, 06 Apr 2005 20:32:20 -0500 From: Haytham Samad Reply-To: samad.haytham@gmail.com User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: commons-user@jakarta.apache.org Subject: [chain] Getting null catalog when using LookupCommand Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I keep getting a null catalog returned to me when I run this example taken from an onjava article. I am using Chains 1.0. Any idea why this is happening? /** * Load and run the catalog. */ package com.jadecove.chain.sample; import java.net.URL; import org.apache.commons.chain.Catalog; import org.apache.commons.chain.Command; import org.apache.commons.chain.Context; import org.apache.commons.chain.config.ConfigParser; import org.apache.commons.chain.impl.CatalogFactoryBase; /** * @author * */ public class CatalogLoader { private static final String CONFIG_FILE = "/com/jadecove/chain/sample/chain-config.xml"; private ConfigParser parser; private Catalog catalog; public CatalogLoader() { parser = new ConfigParser(); } public Catalog getCatalog() throws Exception { if (catalog == null) { URL resource = getClass().getClassLoader().getResource(CONFIG_FILE); URL configFile = this.getClass().getResource(CONFIG_FILE); if(configFile==null){ System.out.println("Config file is null"); } System.out.println("Resource path is " + configFile.getFile()); parser.parse(this.getClass().getResource(CONFIG_FILE)); } catalog = CatalogFactoryBase.getInstance().getCatalog(); return catalog; } public static void main(String[] args) throws Exception { CatalogLoader loader = new CatalogLoader(); Catalog sampleCatalog = loader.getCatalog(); if(sampleCatalog==null){ throw new NullPointerException("catalog not initialized correctly"); } Command command = sampleCatalog.getCommand("sell-vehicle"); Context ctx = new SellVehicleContext(); command.execute(ctx); } } The call loader.getCatalog() always returns a null catalog. Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org