I have run into a dreaded Classloader linking constraint while executing a junit task and need advice on which solution to pursue. Apparently the root of the problem is the duplication of classpaths between the System Classloader and "some other" Classloader. here is the Exception stack: java.lang.LinkageError: loader constraints violated when linking org/xml/sax/ContentHandler class at com.client.Foo.<init>(Foo.java:67) at com.client.test.FooTest.testBar(FooTest.java:43) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:156) 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:160) at junit.framework.TestSuite.run(TestSuite.java:155) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe stRunner.java:209) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnit Task.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) I have attempted to run the junit with fork="yes", but this breaks some other things and is not viable. The junit test runs fine outside of the ant/junit target. (from command prompt) Any input would be appreciated. Here are two useful archive searches that hint at the cause/solution: http://marc.theaimsgroup.com/?l=ant-dev&w=2&r=1&s=loader+constraints+&q= b http://marc.theaimsgroup.com/?l=ant-user&w=2&r=1&s=loader+constraints&q= b Any discussion on this topic is bound to help as I am at a loss to adequately dissect the problem. Tim
Fixing Classloader Linking Errors
Bendfelt, Tim (MED, nVisia, GEMS-IT) Fri, 04 May 2001 12:14:33 -0700
- RE: Fixing Classloader Linking Errors Bendfelt, Tim (MED, nVisia, GEMS-IT)
- RE: Fixing Classloader Linking E... Stephane Bailliez
- Re: Fixing Classloader Linki... Conor MacNeill
- RE: Fixing Classloader Linking E... Bendfelt, Tim (MED, nVisia, GEMS-IT)
- RE: Fixing Classloader Linking E... Stephane Bailliez