ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 1556] New - ClassLinkageError while testing classes which use JAXP classes
Date Fri, 27 Apr 2001 16:14:52 GMT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1556

*** shadow/1556	Fri Apr 27 09:14:52 2001
--- shadow/1556.tmp.20863	Fri Apr 27 09:14:52 2001
***************
*** 0 ****
--- 1,84 ----
+ +============================================================================+
+ | ClassLinkageError while testing classes which use JAXP classes             |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 1556                        Product: Ant                     |
+ |       Status: NEW                         Version: 1.3                     |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Linux                   |
+ |     Priority: Low                       Component: Optional Tasks          |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: kario@mermit.fi                                              |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ I'm trying to use ant for testing classes which use JAXP (more particulary 
+ org.w3c.* and org.xml.* classes).
+ 
+ I'm getting ClassLinkageErrors while trying to load those classes and 
+ IncompatibleClassChangeErrors while trying to use them.
+ 
+ --- stack trace follows ---
+ 
+ java.io.IOException: java.lang.LinkageError: Class org/w3c/dom/Document 
+ violates loader constraints
+         at 
+ org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:439)
+         at 
+ org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:492)
+         at 
+ org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:465)
+         at 
+ org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:369)
+         at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
+         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
+         at 
+ fi.mermit.gateway.mediaclip.smartmessage.BrowserConfig.writeBytes(BrowserConfig.java:349)
+         at 
+ fi.mermit.gateway.mediaclip.smartmessage.BrowserConfig.<init>(BrowserConfig.java:151)
+         at 
+ fi.mermit.gateway.mediaclip.smartmessage.test.TC1_BrowserConfig.syntaxTest(TC1_BrowserConfig.java:
+ 139)
+         at 
+ fi.mermit.gateway.mediaclip.smartmessage.test.TC1_BrowserConfig$1.runTest(TC1_BrowserConfig.java:2
+ 6)
+         at junit.framework.TestCase.runBare(TestCase.java:130)
+         at junit.framework.TestResult$1.protect(TestResult.java:106)
+         at junit.framework.TestResult.runProtected(TestResult.java:124)
+         at junit.framework.TestResult.run(TestResult.java:109)
+         at junit.framework.TestCase.run(TestCase.java:121)
+         at junit.framework.TestSuite.runTest(TestSuite.java:157)
+         at junit.framework.TestSuite.run(TestSuite.java:152)
+         at 
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:209)
+         at 
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:409)
+         at 
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:283)
+         at 
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:263)
+         at org.apache.tools.ant.Target.execute(Target.java:153)
+         at org.apache.tools.ant.Project.runTarget(Project.java:898)
+         at org.apache.tools.ant.Project.executeTarget(Project.java:536)
+         at org.apache.tools.ant.Project.executeTargets(Project.java:510)
+         at org.apache.tools.ant.Main.runBuild(Main.java:421)
+         at org.apache.tools.ant.Main.main(Main.java:149)
+ 
+ --- stack trace ends ---
+ 
+ The only explanation that I can think of is that the classes are loaded twice. 
+ First by the default system ClassLoader when Ant uses them to parse the 
+ build.xml file and the second time by AntClassLoader when my own classes use 
+ them. These two versions somehow get mixed up.
+ 
+ I've managed to get past this problem by adding the org.w3c.* and org.xml.* 
+ classes into system classpath using addSystemPackageRoot method in the 
+ constructor of AntClassLoader so that they are always loaded using the system 
+ default ClassLoader no matter what.
+ 
+ Happy bughunting...
+ 
+ Janne Kario
+ <kario@mermit.fi>

Mime
View raw message