Mike,

 

            I have single “TransformerFactory” for the application (instantiating on first request) and I am not sure how it is going to help me with the following statement?

 

((TransformerFactoryImpl)factory).getController().setNamePool(new NamePool());

 

Is this ok if I create new ‘TransformerFactory’ for each Transformation Request? I thought this might be expensive than using Single TranformerFactory. Is there any way I can reset these Name Pools on each Transformation request or something like that?

 

Thanks,

Srini


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Tuesday, November 14, 2006 5:26 PM
To: 'Mailing list for SAXON XSLT queries'
Subject: Re: [saxon] Any thoughts about this Exception 'Saxon namepoolisfull'??

 

Ah!

 

By default the NamePool is allocated statically, so it is shared by every TransformerFactory instantiated during the life of the Java VM.

 

In your situation you should allocate a new NamePool for each TransformerFactory. Immediately after creating the TransformerFactory, do

 

((TransformerFactoryImpl)factory).getController().setNamePool(new NamePool());

 

This should also give you a performance improvement as the hash chains were probably getting very long.

 

Using a single NamePool is advantageous where the vocabulary in use is bounded; in a case like yours it's better to use smaller NamePools, the fact that some names will appear in each hardly matters.

 

(The original justification for a default static NamePool, I now recall, was that initializing the NamePool was quite expensive because it contained a large number of predefined names, e.g. the names of all XSLT elements and attributes. However, that's no longer the case, so perhaps I should consider changing this.)

 

Michael Kay

http://www.saxonica.com/

 


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Kusunam, Srinivas
Sent: 14 November 2006 22:08
To: Mailing list for SAXON XSLT queries
Subject: Re: [saxon] Any thoughts about this Exception 'Saxon name poolisfull'??

Mike,

 

            We have this application deployed in to production and it will be running 24/7 processing different XML files (6 types) using Message Driven Beans (for almost 3 months) and also I have an XSL for each type. My XSL is not un-usual and here I am attaching my XSL. As you said I got exception while loading Stylesheet for the current document, but it could happen that Name Pool might have been already full with the previous documents. Also, we have very finite set of element names and namespaces declared for these 6 document types.  

 

With your explanation how does the name pool cache works for multiple documents? Is it going to keep everything in memory for all the documents coming in until you restart the JVM instance? When does it go to Garbage collection?

 

We are using a single TranformerFactory instance for all the transformations. Is this Name pool has 1-1 relation with Transformer Factory?

 

 

Thanks,

Srini

 


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Tuesday, November 14, 2006 12:15 PM
To: 'Mailing list for SAXON XSLT queries'
Subject: Re: [saxon] Any thoughts about this Exception 'Saxon name pool isfull'??

 

I've never seen this happen before but I always assumed it would happen one day, probably with machine generated source documents using a large number of generated names. The name pool is used to allocate integer codes to names occurring in your source document, stylesheet, etc. There's 20 bits allocated to hash the URI and local name; 10 bits to identify the hash bucket and 10 bits for the names within one bucket. This particular message means that one of the hash buckets already has 1024 names in it. This is either because you really do have an exceptionally large number of names in use, or it means that the hashing function isn't working well and lots of stuff is going into the same bucket.

 

The thing that surprises me here is that the error occurs while processing the stylesheet, and it looks as if the source documents have not yet been loaded. Is that the case? Is your stylesheet unusual in any way?

 

Michael Kay

 

 

 


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Kusunam, Srinivas
Sent: 14 November 2006 16:18
To: Mailing list for SAXON XSLT queries
Subject: [saxon] Any thoughts about this Exception 'Saxon name pool is full'??

Hi Group,

 

       We are using Saxon (8.0) for merging 2 XML documents and producing a 3rd XML using XSLT. We got the following exception couple of days back. I am using a custom TransformerFactory (Singleton) to get a Transformer. Any pointers or suggestions are welcome……

 

net.sf.saxon.om.NamePool$NamePoolLimitException: Saxon name pool is full

        at net.sf.saxon.om.NamePool.allocate(NamePool.java:493)

        at net.sf.saxon.om.NamePool.allocate(NamePool.java:453)

        at net.sf.saxon.expr.ExpressionTool.resolveCallsToCurrentFunction(ExpressionTool.java:509)

        at net.sf.saxon.style.StyleElement.typeCheck(StyleElement.java:951)

        at net.sf.saxon.style.XSLValueOf.validate(XSLValueOf.java:83)

        at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1127)

        at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1161)

        at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1136)

        at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1161)

        at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1136)

        at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1161)

        at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1136)

        at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1161)

        at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1136)

        at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1161)

        at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1136)

        at net.sf.saxon.style.XSLStylesheet.preprocess(XSLStylesheet.java:637)

        at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:269)

        at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:117)

        at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:133)

        at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:88)

        at com.comp.MyTransformerFactory.getTransformer(MyTransformerFactory.java:29)

 

 

Here is my Transformer Factory:

 

public class MyTransformerFactory {

  private static TransformerFactory transformerFactory;

 

  private static TransformerFactory getTransformerFactory() throws Exception{

      if (transformerFactory == null) {

        System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl"); 

        transformerFactory = TransformerFactory.newInstance();

      }

      return transformerFactory;

  }

 

  public static Transformer getTransformer(final String xslNameLocation) throws Exception {

    try {

      return getTransformerFactory().newTransformer(new StreamSource(xslNameLocation));

    } catch (Exception e) {

      throw e;

    }

  }

}

 

Thanks,

Srini

*****************************************************************
This message has originated from RLPTechnologies,
26955 Northwestern Highway, Southfield, MI 48033.
 
RLPTechnologies sends various types of email
communications.  If this email message concerns the
potential licensing of an RLPT product or service, and
you do not wish to receive further emails regarding Polk
products, forward this email to Do_Not_Send@rlpt.com
with the word "remove" in the subject line.
 
The email and any files transmitted with it are confidential
and intended solely for the individual or entity to whom they
are addressed.
 
If you have received this email in error, please delete this
message and notify the Polk System Administrator at
postmaster@rlpt.com.
*****************************************************************
 
*****************************************************************
This message has originated from RLPTechnologies,
26955 Northwestern Highway, Southfield, MI 48033.
 
RLPTechnologies sends various types of email
communications.  If this email message concerns the
potential licensing of an RLPT product or service, and
you do not wish to receive further emails regarding Polk
products, forward this email to Do_Not_Send@rlpt.com
with the word "remove" in the subject line.
 
The email and any files transmitted with it are confidential
and intended solely for the individual or entity to whom they
are addressed.
 
If you have received this email in error, please delete this
message and notify the Polk System Administrator at
postmaster@rlpt.com.
*****************************************************************
 
*****************************************************************
This message has originated from RLPTechnologies,
26955 Northwestern Highway, Southfield, MI 48033.

RLPTechnologies sends various types of email
communications.  If this email message concerns the
potential licensing of an RLPT product or service, and
you do not wish to receive further emails regarding Polk
products, forward this email to Do_Not_Send@rlpt.com
with the word "remove" in the subject line.

The email and any files transmitted with it are confidential
and intended solely for the individual or entity to whom they
are addressed.

If you have received this email in error, please delete this
message and notify the Polk System Administrator at
postmaster@rlpt.com.
*****************************************************************