[jdom-interest] SAXBuilder / JAXP error

Jason Hunter jhunter at servlets.com
Thu Nov 1 15:04:18 PST 2001


I wonder if Weblogic 6.1 reimplemented the JAXP libraries and added this
as a bug.

-jh-

Alastair Rodgers wrote:
> 
> Hi,
> 
> I have been using JDOM within Weblogic 6.0 for some time, but have come across a  JAXP / SAXBuilder problem when trying to migrate to Weblogic 6.1. The problem arises in a custom Weblogic startup class I've written. Basically, if I code it as follows I don't get a problem:
> 
>         File[] oFiles = ...[get list of files]...
>       for (int i = 0; i < oFiles.length; i++) {
>         Document oDoc = new SAXBuilder().build(oFiles[i]);
>         ...[do stuff]...
>       }
> 
> However, if instead of creating a new SAXBuilder on each iteration, I just create a single instance and reuse it:
> 
>       SAXBuilder oBuilder = new SAXBuilder();
>         File[] oFiles = ...[get list of files]...
>       for (int i = 0; i < oFiles.length; i++) {
>         Document oDoc = oBuilder.build(oFiles[i]);
>         ...[do stuff]...
>       }
> 
> ...then it executes OK for the first file, but when it tries to do oBuilder.build() for the second time, I get the following error:
> 
> Error in building: SAX2 driver class weblogic.xml.jaxp.RegistryXMLReader loaded but cannot be instantiated (no empty public constructor?)
> org.jdom.JDOMException: Error in building: SAX2 driver class weblogic.xml.jaxp.RegistryXMLReader loaded but cannot be instantiated (no empty public constructor?)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:306)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:617)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:599)
>         ...[etc]...
> Root cause: java.lang.InstantiationException: weblogic.xml.jaxp.RegistryXMLReader
>         at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:124)
>         at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:360)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:283)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:617)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:599)
>         ...[etc]...
> 
> Does anyone know why this is? Both mechanisms work in Weblogic 6.0 but I can't see what's different in 6.1 which would cause it to fail. I seem to remember a while back someone on this mailing list saying that its wisest to always create a new SAXBuilder instance for each build() call, but I haven't been able to track this down in the archives. Is this true? If so, why?
> 
> Thanks for any help.
> 
> Al Rodgers
> Senior Developer
> Phocis Ltd
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list