xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
[XOM-interest] classloading bug with xom used in servlet
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: xom-interest AT lists.ibiblio.org
- Subject: [XOM-interest] classloading bug with xom used in servlet
- Date: Mon, 02 Feb 2004 11:32:47 -0800
Hi,
In d23 there seems to be a classloading bug that manifests itself when using xom in a servlet where xom.jar is put into WEB-INF/lib. Here, the Verifier cannot be initialized and throws a java.lang.ExceptionInInitializerError
at nu.xom.Element.setNamespaceURI(Element.java:719)
I tentatively patched the way the Verifier looks up characters.dat so that it works for me in the servlet case:
static {
//ClassLoader loader = ClassLoader.getSystemClassLoader();
//DataInputStream in = new DataInputStream(
// loader.getResourceAsStream("nu/xom/characters.dat"));
DataInputStream in = new
DataInputStream(getResourceAsStream("nu/xom/characters.dat"));
// no other changes
// ...
}
private static java.io.InputStream getResourceAsStream(String fileName) {
ClassLoader loader =
Thread.currentThread().getContextClassLoader();
if (loader == null) { // there may not be a context class
loader
loader = Verifier.class.getClassLoader();
}
return loader.getResourceAsStream(fileName);
}
Above patch works for me but can perhaps be improved - I'm no class loader guru either...
Regards,
Wolfgang.
-
[XOM-interest] classloading bug with xom used in servlet,
Wolfgang Hoschek, 02/02/2004
- Re: [XOM-interest] classloading bug with xom used in servlet, Bill de hÓra, 02/02/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Elliotte Rusty Harold, 02/02/2004
- Re: [XOM-interest] classloading bug with xom used in servlet, Bill de hÓra, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Elliotte Rusty Harold, 02/02/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Bill de hÓra, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Elliotte Rusty Harold, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Bill de hÓra, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
John Cowan, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Elliotte Rusty Harold, 02/03/2004
- Re: [XOM-interest] classloading bug with xom used in servlet, John Cowan, 02/04/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Elliotte Rusty Harold, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
John Cowan, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Bill de hÓra, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Elliotte Rusty Harold, 02/03/2004
-
Re: [XOM-interest] classloading bug with xom used in servlet,
Bill de hÓra, 02/03/2004
Archive powered by MHonArc 2.6.24.