ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Blunck <blu...@gst.com>
Subject Re: AntClassLoader Question (problem?)
Date Thu, 13 Feb 2003 14:41:55 GMT
Stu-

Thanks for the response!  Since we're using WebLogic 6.1, we haven't started
using JDK 1.4 yet.  As such, my experience level with JDK 1.4 is very low.
I was unaware of endorsed classes, so thanks for pointing that out to me.

I'll give it a shot, and I'm anticipating that it will work flawlessly.


Thanks again Stu,
-c

On Wed, Feb 12, 2003 at 06:28:21PM -0500, Stu Halloway (DevelopMentor) wrote:
> Hi Christopher,
> 
> Have you tried shoving the org.xml classes into the endorsed standards 
> override directory? [1]
> 
> Stu
> 
> [1] http://java.sun.com/j2se/1.4.1/docs/guide/standards/index.html
> 
> ----------------------------------------------------------
> Stuart Halloway         : staff.develop.com/halloway
> DevelopMentor           : www.develop.com
> Essential Java          : www.develop.com/courses/essjava
> ----------------------------------------------------------
> 
> Christopher Blunck wrote:
> >Hi,
> >
> >I hope this email reaches the mailing list.  I subscribed 10+ minutes ago,
> >but haven't received a response from your mailing list manager.  As a 
> >result,
> >I'd appreciate it if any replies can be Cc:'ed to my email address.  
> >Thanks.
> >
> >Here's my situation, and I'm hoping somebody can comment on it.
> >
> >In ant, when I run my junits, I assemble a classpath that contains 
> >weblogic.jar.
> >We use WebLogic 6.1 SP2 (which is not compatible with JDK 1.4 and the newer
> >XML libraries).  I have a junit test that uses Apache SOAP (v2.2) to make
> >a call to our application.  When SOAP tries to assemble the XML message to
> >post to the servlet on the server side, it needs to load a parser.  How
> >does it do so?  It uses javax.xml.parsers.DocumentFactory.  This class is
> >defined both in rt.jar (which comes with JDK 1.4) as well as in 
> >weblogic.jar.
> >I'll refer to DocumentFactory(w) as the WebLogic version of 
> >DocumentFactory,
> >and DocumentFactory(j) as the JDK version of DocumentFactory.  When ant's
> >classloader is asked to load javax.xml.parsers.DocumentFactory, it uses the
> >parent classloader (the JDK classloader) because the constructor for
> >AntClassLoader calls addSystemPackageRoot("javax").  When the 
> >loadClass(...)
> >method in AntClassLoader is called, if the class to be loaded begins with
> >any of the "system packages" (java or javax), it delegates loading to
> >the parent classloader (the system classloader).  The result?  
> >AntClassLoader
> >returns DocumentFactory(j) (the DocumentFactory that comes with JDK 1.4).
> >Sounds reasonable to me...
> >
> >DocumentFactory (or some class that DocumentFactory calls) uses an 
> >org.xml.sax.InputSource.  This class is also defined both in rt.jar from
> >the JDK distribution as well as in weblogic.jar.  When DocumentFactory 
> >tries
> >to load InputSource, AntClassLoader looks at "org.xml.sax.InputSource" and 
> >says "that's not a system package", and thus it (AntClassLoader) loads the
> >class using it's own rule(s) (which really just use the classpath I have
> >defined in my build.xml).  The result?  AntClassLoader returns
> >InputSource(w) (the InputSource that comes with weblogic) because it starts
> >with org.xml.sax and is not a system package.
> >
> >When all the dust settles, I have a DocumentFactory from the JDK and an
> >InputSource from weblogic.  The two don't line up, and I get a 
> >LinkageError.
> >
> >I changed the source code for the constructor for AntClassLoader so that it
> >does *not* add javax as a system package.  This forced AntClassLoader to
> >load the DocumentFactory from weblogic.jar instead of rt.jar, and since 
> >InputSource is read from weblogic.jar everything lined up and the my unit
> >test ran successfully.
> >
> >I'm writing because I'm not particularly happy with changing the source 
> >code
> >of an open source project without notifying the maintainers of my problem 
> >and
> >asking for any advice or insight they may have into a solution.  I realize 
> >that
> >part of this problem derives from using weblogic.jar, but I'm unwilling to
> >accept that as the full explanation (saying Ant 1.5.1 and WebLogic 6.1 SP2
> >are *incompatible* seems a bit harsh).  
> >
> >Any words of wisdom?
> >
> >
> >-c
> >

-- 
  9:40am  up 115 days,  1:15,  1 user,  load average: 0.87, 3.38, 4.29

Mime
View raw message