Hello, Daniel!

TDF> Thats really helpful thanks Anton.
You're welcome :)

TDF> I now know that the root of the problem
TDF> is a LinkageError. So without wishing to wander OT  or push my luck do you
TDF> (or anyone else) have any idea what might cause this? I've tried a few
TDF> different Xerces jars without solving the problem. ant -debug -verbose
TDF> output follows...


TDF>     [junit] Using CLASSPATH
TDF> C:\dev\java\trash\bin;C:\java\jakarta\avalon\Avalon-4.1.4\avalon-framework-4
TDF> .1.4.jar;C:\java\jakarta\avalon\phoenix-4.0.4\lib\xercesImpl-2.0.2.jar;C:\ja
TDF> va\jakarta\avalon\phoenix-4.0.4\lib\xml-apis.jar;C:\java\junit3.8.1\junit.ja
TDF> r;C:\java\apache-ant-1.5.3-1\lib\ant.jar;C:\java\apache-ant-1.5.3-1\lib\opti
TDF> onal.jar

TDF>     [junit] loader constraints violated when linking org/xml/sax/XMLReader class
TDF>     [junit] java.lang.LinkageError: loader constraints violated when linking 
org/xml/sax/XMLReader class
TDF>     [junit]     at 
org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImp l.java:95)
TDF>     [junit]     at 
org.apache.avalon.framework.configuration.DefaultConfigurationBuilder.<init> 
(DefaultConfigurationBuilder.java:142)

I have a guess. Are you on JDK 1.4?
If yes, there's a Xerces included. Moreover, xml-apis.jar contains
javax.parser classes and alike and they are also included in your
JDK.

So,

1) try removing just xml-apis.jar from your classpath

   I beleive this is what is causing conflicts:

   Ant magical machinery has given preference to what is
   explicitly specified in build.xml I guess, and

   SAXParserFactory has probably loaded from xml-apis.jar
   XMLReader has probably loaded from it too
   
   but then SAXParserFactory somehow loaded something
   from the xerces in the root classloader (the main JDK one)
   (maybe Xerces implementation of XMLReader and oops-
   you've got an object that implements XMLReader, but the
   wrong XMLReader - from the wrong classloader.

   This happens because Ant classloader breaks the original
   classloader contract that a classloader first asks its
   parent loader for a class and only then it tries on its own.

   Ant classloader may do it both ways depending on setup.

   So, in short nuke xml-apis.jar from your classpath,
   you don't need with JDK 1.4

   Xerces on your classpath looks harmless and useless to me,
   so you may want to remove it too.

WBR, Anton
   
OT: BTW I personally already had to unpack my rt.jar from JDK 1.4.1
and put there the new Xalan (minus the bcle included into the Xalan
jar) because the Xalan shipped with 1.4.1 turned out to be buggy :-(


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to