Puzzling.
 
Actually I think the root cause is the NullPointerException.
 
The code on line 231 is doing: Configuration.class.getClassLoader().getResourceAsStream(sConfigFile);
 
I note that the comment on getClassLoader() says "Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class was loaded by the bootstrap class loader." I suppose that a class in the endorsed library is loaded using the bootstrap class loader, which explains why you are seeing the effect.
 
I'm not quite sure what to do about it: perhaps if class.getClassLoader() returns null, I should use Thread.currentThread().getContextClassLoader(). But that can be null too. Or perhaps I should do new ClassLoader(), or perhaps ClassLoader.getSystemClassLoader()?  I'll have to do some experiments.
 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay



From: Dannes Wessels [mailto:dizzzz@exist-db.org]
Sent: 18 November 2009 21:13
To: Dannes Wessels
Cc: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] NPE in TransformerFactory.newInstance()

Responding myself:

On 16 Nov 2009, at 20:24 , Dannes Wessels wrote:

I replaced my older saxon.jar with the newer saxon9he.jar (drop-in replacement) but this yields into a NPE.... The root cause seems to be "Failed to load configuration defined in edition.properties".

java.lang.NullPointerException
at net.sf.saxon.Configuration.<clinit>(Configuration.java:231)
at net.sf.saxon.TransformerFactoryImpl.<init>(TransformerFactoryImpl.java:36)

I normally put the saxon jars (and xerces, xalan etc) as 'endorsed' jars on the classpath.... changing that does the trick...

hmmmmmm....

Kind regards

Dannes

--
eXist-db Native XML Database - http://exist-db.org