Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 47133 invoked from network); 24 Jan 2005 21:56:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 Jan 2005 21:56:36 -0000 Received: (qmail 32961 invoked by uid 500); 24 Jan 2005 21:56:31 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 32915 invoked by uid 500); 24 Jan 2005 21:56:31 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 32901 invoked by uid 99); 24 Jan 2005 21:56:31 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: unknown (hermes.apache.org: error in processing during lookup of toby@caboteria.org) Received: from smtp02.mrf.mail.rcn.net (HELO smtp02.mrf.mail.rcn.net) (207.172.4.61) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 24 Jan 2005 13:56:29 -0800 Received: from 207-172-209-236.c3-0.ded-ubr1.sbo-ded.ma.cable.rcn.com ([207.172.209.236] helo=mail.caboteria.org) by smtp02.mrf.mail.rcn.net with esmtp (Exim 3.35 #7) id 1CtCC9-0005M3-00 for dev@geronimo.apache.org; Mon, 24 Jan 2005 16:56:25 -0500 Received: by mail.caboteria.org (Postfix, from userid 1000) id 84C7CC4094; Mon, 24 Jan 2005 16:56:35 -0500 (EST) Date: Mon, 24 Jan 2005 16:56:35 -0500 From: toby cabot To: dev@geronimo.apache.org Subject: problem with xerces and web apps Message-ID: <20050124215635.GA16361@caboteria.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6+20040907i X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi Folks, I've been using Geronimo for a while now and it works great. I just updated from Subversion today and now I have a problem at run-time with Xerces inside a web app that appears to be classloader related. I'm using Axis which uses Xerces so I added the xerces jars to my .war file. When Xerces starts I get: java.lang.ClassCastException at org.apache.xerces.parsers.DOMParser.(DOMParser.java:138) at org.apache.xerces.parsers.DOMParser.(DOMParser.java:108) at org.apache.xerces.jaxp.DocumentBuilderImpl.(DocumentBuilderImpl.java:52) at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:47) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:291) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:308) at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:176) at org.apache.axis.AxisEngine.init(AxisEngine.java:162) at org.apache.axis.AxisEngine.(AxisEngine.java:146) at org.apache.axis.server.AxisServer.(AxisServer.java:87) at org.apache.axis.server.DefaultAxisServerFactory.createServer(DefaultAxisServerFactory.java:109) at org.apache.axis.server.DefaultAxisServerFactory.getServer(DefaultAxisServerFactory.java:73) at org.apache.axis.server.AxisServer.getServer(AxisServer.java:72) at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:183) at org.apache.axis.transport.http.AxisServletBase.getOption(AxisServletBase.java:370) at org.apache.axis.transport.http.AxisServletBase.init(AxisServletBase.java:110) at javax.servlet.GenericServlet.init(GenericServlet.java:168) The Xerces code looks like (see [1]): super((XMLParserConfiguration)ObjectFactory.createObject( "org.apache.xerces.xni.parser.XMLParserConfiguration", "org.apache.xerces.parsers.XML11Configuration" )); So it looks as if the problem is that the object that comes back from ObjectFactory.createObject() can't be cast to an XMLParserConfiguration. The strange part is that it looks as if the correct object is coming back, at least if I just print out the class name. The difference between a 2 week old Geronimo build and this one is that this one appears to have two different instances of org.apache.geronimo.jetty.JettyClassLoader in play, whereas the 2 week old version only had one. Xerces ObjectFactory has explicit code to find the right classloader to use, their code is in findClassLoader() at [2], in the two week old Geronimo build that code returned the same classloader that this.getClass().getClassLoader() returns and the cast succeeds, in the current build it finds a different classloader and the cast throws a ClassCastException. Any ideas how I can get around this are appreciated. Thanks, Toby [1] DOMParser.java: http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java?rev=1.72&view=auto [2] Code that Xerces uses to find the classloader: http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/parsers/ObjectFactory.java?rev=1.9&view=auto