Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.0 alpha 1 is here

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Michael Abato <mrabato AT earthlink.net>
  • To: xom-interest AT lists.ibiblio.org
  • Cc: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Subject: Re: [XOM-interest] XOM 1.0 alpha 1 is here
  • Date: Tue, 8 Jun 2004 15:25:04 -0400

I have verified that the problem definitely remains for tomcat (3.3.x thru 5.0.x) and websphere 5.1. According to http://nagoya.apache.org/jira/browse/XERCESJ-976 (section 2) it will be a problem for all servlet, J2EE, and other containers using multiple classloaders. The problem is that XOM does

System.setProperty(
"org.apache.xerces.xni.parser.XMLParserConfiguration",
"nu.xom.xerces.XML1_0ParserConfiguration");

locally, in the webapp classloader, but the property is subsequently available to all classloaders (webapps/EJB's/etc.) which do not necessarily have access to nu.xom.xerces.XML1_0ParserConfiguration, and therefore throw ClassNotFoundException.

I've put up a sample project at http://home.earthlink.net/~mrabato/xom-test.tgz which includes two war files (and their associated source/build files). Both can be installed simply on any servlet container. On tomcat, use the manager webapp with the simple war file deployment form. 'xerces-runner' reads a trivial xml document via sax. 'xom-runner' does the same via XOM. If you run xerces-runner AFTER running xom-runner you will get the ClassNotFoundException.

I can see two classes of solutions: checking for XML 1.1 only if requested (e.g..: configured to do so with a system property) and checking by default, but not if in a known "container". The first means system properties or static methods, neither of which is great. The later will always "fail" on an as-yet-unwritten/unknown container.

I would favor looking for system property "javax.servlet.context.tempdir" (which implies you are in a servlet container) and respecting a user-set system property like "nu.xom.no-verify-XML1_0". Other known containers could be added as "signals" are identified. Does anyone know a good EJB signal?

Michael Abato

On Jun 8, 2004, at 11:45 AM, Elliotte Rusty Harold wrote:

I have not yet resolved some of the class loader issues reported by various people. I'd appreciate it if anyone who's encountered a problem with XOM when used in TomCat or other multi-classloader environments let me know if the problem still occurs with the latest release. If it does, let me know and fixing that will be the highest priority for alpha 2.





Archive powered by MHonArc 2.6.24.

Top of Page