You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by simon <sk...@apache.org> on 2007/08/09 15:24:09 UTC

Re: [digester] [chain] Null Pointer Exception on the Digester parse of the chain-config.xml

Hi Vijay,

When sending an email to this list please put the relevant commons
component name(s) in the subject line. I've done this for this reply..

On Wed, 2007-08-08 at 15:59 -0700, Vijay Balakrishnan wrote:
> I keep getting a Null Pointer Exception on the Digester parse of the
> chain-config.xml.Using Commons Chain 1.1 with the digester jar and beanutils
> and logging jars.

> 
> 1. CatalogLoader.java:
> 
> public Catalog getCatalog(String configfile) throws Exception {
>     ConfigParser parser = new ConfigParser();<== done in Constructor
> CatalogLoader()
>     if (catalog == null) {
>         URL configFileUrl = FileUtils.findURL("chain-config.xml");//find
> this from claspath
>         //Thread.currentThread().getContextClassLoader().getResource(new
> File("chain-config.xml"));
>         //<== I am able to see the contents of the chain-config.xml
> 
>         parser.parse(configFileUrl);<== fails here
> 
>     }
>     catalog = CatalogFactoryBase.getInstance().getCatalog();
>     return catalog;
>     }
> 
> 
> 
> 
> 
> 
> 
> 2. chain-config.xml:
> 
> <?xml version="1.0" ?>
> <catalogs>
> <catalog name="sentinel">
>   <chain name="loginProcessor">
>     <command id="securityEqualsHeaderProcessor" classname="
> com.usbank.aid.chain.SecurityEqualsHeaderProcessor"
>         />
>   </chain>
> </catalog>
> </catalogs>
> 
> 
> 3. SecurityEqualsHeaderProcessor.java :
> 
> public class SecurityEqualsHeaderProcessor implements Command {
> 
>     private String oldNames;
>     ...
> 
> 
> I keep getting a Null Pointer Exception. Here is the stack Trace:
> 
> at org.apache.commons.digester.Digester.createSAXException(Digester.java
> :3181)
>     at org.apache.commons.digester.Digester.createSAXException(Digester.java
> :3207)
>     at org.apache.commons.digester.Digester.startElement(Digester.java:1456)
>     at org.apache.xerces.parsers.AbstractSAXParser.startElement(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.XML11Configuration.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:1745)
>     at org.apache.commons.chain.config.ConfigParser.parse(ConfigParser.java
> :198)



What version of digester is in your classpath?

The latest release is 1.8, but line 3181 is this one:
         return new SAXParseException(error, locator, e);
which shouldn't ever throw a NullPointerException.


I suggest enabling debug-level logging for category
org.apache.commons.digester and sending the last 20 lines or so of the
output to this list too.

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [digester] [chain] Null Pointer Exception on the Digester parse of the chain-config.xml

Posted by Vijay Balakrishnan <bv...@gmail.com>.
After debugging through the Digester 1.8 code,The error ended up being in
the chain-config.xml with a typo on attribute name className. I had it as
classname and that caused the error. One would have thought that the
attribute names are not case sensitive.
Correct version is here :
<?xml version="1.0" ?>
<catalogs>
<catalog name="sentinel">
  <chain name="loginProcessor">
    <command id="securityEqualsHeaderProcessor"
name="securityEqualsHeaderProcessor" className="
com.usbank.aid.chain.SecurityEqualsHeaderProcessor"
        />
  </chain>
</catalog>
</catalogs>

Thanks, Simon for replying to my email.

Vijay

On 8/9/07, simon <sk...@apache.org> wrote:
>
> Hi Vijay,
>
> When sending an email to this list please put the relevant commons
> component name(s) in the subject line. I've done this for this reply..
>
> On Wed, 2007-08-08 at 15:59 -0700, Vijay Balakrishnan wrote:
> > I keep getting a Null Pointer Exception on the Digester parse of the
> > chain-config.xml.Using Commons Chain 1.1 with the digester jar and
> beanutils
> > and logging jars.
>
> >
> > 1. CatalogLoader.java:
> >
> > public Catalog getCatalog(String configfile) throws Exception {
> >     ConfigParser parser = new ConfigParser();<== done in Constructor
> > CatalogLoader()
> >     if (catalog == null) {
> >         URL configFileUrl = FileUtils.findURL("chain-config.xml");//find
> > this from claspath
> >         //Thread.currentThread().getContextClassLoader().getResource(new
> > File("chain-config.xml"));
> >         //<== I am able to see the contents of the chain-config.xml
> >
> >         parser.parse(configFileUrl);<== fails here
> >
> >     }
> >     catalog = CatalogFactoryBase.getInstance().getCatalog();
> >     return catalog;
> >     }
> >
> >
> >
> >
> >
> >
> >
> > 2. chain-config.xml:
> >
> > <?xml version="1.0" ?>
> > <catalogs>
> > <catalog name="sentinel">
> >   <chain name="loginProcessor">
> >     <command id="securityEqualsHeaderProcessor" classname="
> > com.usbank.aid.chain.SecurityEqualsHeaderProcessor"
> >         />
> >   </chain>
> > </catalog>
> > </catalogs>
> >
> >
> > 3. SecurityEqualsHeaderProcessor.java :
> >
> > public class SecurityEqualsHeaderProcessor implements Command {
> >
> >     private String oldNames;
> >     ...
> >
> >
> > I keep getting a Null Pointer Exception. Here is the stack Trace:
> >
> > at org.apache.commons.digester.Digester.createSAXException(Digester.java
> > :3181)
> >     at org.apache.commons.digester.Digester.createSAXException(
> Digester.java
> > :3207)
> >     at org.apache.commons.digester.Digester.startElement(Digester.java
> :1456)
> >     at org.apache.xerces.parsers.AbstractSAXParser.startElement(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.XML11Configuration.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:1745)
> >     at org.apache.commons.chain.config.ConfigParser.parse(
> ConfigParser.java
> > :198)
>
>
>
> What version of digester is in your classpath?
>
> The latest release is 1.8, but line 3181 is this one:
>          return new SAXParseException(error, locator, e);
> which shouldn't ever throw a NullPointerException.
>
>
> I suggest enabling debug-level logging for category
> org.apache.commons.digester and sending the last 20 lines or so of the
> output to this list too.
>
> Regards,
>
> Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>