commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Clarke" <>
Subject [Chain] re: Problem with CatalogFactory - getCatalog() returns null
Date Mon, 10 Apr 2006 13:14:02 GMT
Hi all,

I'm having an issue with getting a Catalog from the CatalogFactory with Commons Chain. I've
defined my own XML configuration file as follows:

<?xml version="1.0" ?>
  <chain name="logon">
      <command name="CheckCredentials" className="com.talis.springbok.jsfspike.manager.logon.commands.CheckCredentials"/>
      <command name="RetrievePermissions" className="com.talis.springbok.jsfspike.manager.logon.commands.RetrievePermissions"/>

I have some initialisation code that is in a ContextListener which is called when Tomcat starts
up the web app:

public class ChainListener implements ServletContextListener
    public void contextInitialized(ServletContextEvent servletContextEvent)
        String resource = servletContextEvent.getServletContext().getInitParameter("org.apache.commons.chain.CONFIG_CLASS_RESOURCE");
            ChainHelper ch = new ChainHelper();
        catch (Exception e)
            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.

which calls....

01    public void init(String resource) throws Exception
02    {
03       CatalogFactory cf = CatalogFactoryBase.getInstance();
04        ConfigParser parser = new ConfigParser();
05        parser.parse(this.getClass().getClassLoader().getResource(resource));
06        catalog = cf.getCatalog();
07    }

When I debug the code above with breakpoints:

line 05: The resource is correctly retrieved and the parser parses it without throwing an
Exception. If I look into the ConfigParser object after this line has executed I can see that
it has loaded in the class names of the commands defined in my XML file

line 06: This returns null! If I look inside the context factory it has a list of catalogs
of size zero so the parser hasn't initialised the catalog into the factory!

Is there anything I am missing from my code and/or XML config file?



Reunite with Talis at the Library and Information Show, April 26th - 27th 

As a major sponsor of LiS, we are delighted to announce that we will be exhibiting and sponsoring
the Reunion Bar at the centre of the exhibition hall. At booth 708, we will be unveiling details
of Talis Source, our next generation community based service for resource discovery and resource
sharing. At LiS, we will also showcase a range of new services powered by the Talis Platform
including a directory service, data aggregation, enrichments and transaction services. 

Speaker Session 

Ken Chad, Executive Director will be presenting on Web 2.0 and the impact on libraries on
Wednesday 10:20 in Theatre 1. This session is an ideal opportunity to find out more about
library 2.0. For additional information view the conference programme. 

If you have not yet registered to attend LiS 2006, click here  and register online. 

Any views or personal opinions expressed within this email may not be those of Talis Information
Ltd. The content of this email message and any files that may be attached are confidential,
and for the usage of the intended recipient only. If you are not the intended recipient, then
please return this message to the sender and delete it. Any use of this e-mail by an unauthorised
recipient is prohibited.

  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message