>Something to do with Ant using Crimson.jar and jspc task requiring xerces that ships with Tomcat?
That would be a good guess to test. Realise also that for in-proc tasks the ANT classloader puts itself in a special 'isolated' mode when it does not delegate to the parent loader (this would be the appplication/-classpath loader) unless the class name matches things like "java.*, javax.*" -- can cause weird things to happen. You could also try to track which loader loaded which class. Use -verbose:class for the VM and I forget now how to make ANT's classloader become verbose (is that the -debug ANT option?). Vlad. Please respond to "Ant Users List" <[EMAIL PROTECTED]> To: "Ant Users List" <[EMAIL PROTECTED]> cc: Subject: Re: Linkage error with new jspc task Yeah, agreed...except that in this case I AM managing my classpath myself within the Ant target (see code at bottom), and I still get the error! I have nothing in my OS classpath variable. Something to do with Ant using Crimson.jar and jspc task requiring xerces that ships with Tomcat? Am I missing something? Cheers, Dave [EMAIL PROTECTED] on 01/09/2002 05:10:49 PM Please respond to "Ant Users List" <[EMAIL PROTECTED]> To: "Ant Users List" <[EMAIL PROTECTED]> cc: (bcc: David Hay/Lex/Lexmark) Subject: Re: Linkage error with new jspc task Loader constraint violations are usually caused by a situation in which two classloaders, if asked where they would get a class from, disagree about the location. This is typically brought to the front and causes an actual exception below when two classes loaded by distinct classloaders exchange data and usage of that data causes more classes to be loaded. The best way to ensure this does not happen it to understand the classloader hierarchy (including all parent-child relationships) for your runtime and make sure that every class has a unique defining classpath for it. This helps: - do not use the CLASSPATH OS environment variable at all. There is no need and it causes more confusion then it aids, because you tend to forget about what's in it. - do not keep anything in <jdk home>/jre/lib/ext. Period. The extensions are loaded by an extension classloader which sits between the bootstrap one and the application (-classpath) one and hence every extension is implicitly ahead of anything in the -classpath/CLASSPATH. This can cause issues with dynamic resource loading. [When a class does Class.forName() this will use the defining loader for the calling class and in the extension case this would be the extension classloader, one that does not even know about -classpath. Unless the code was written to anticipate that, this will cause problems. This has confused many a person already who installed jaxp.jar in jre/lib/ext and is why Sun had to add Thread context classloaders etc etc -- a whole separate topic, just don't do it.] Note for IBM JDK users: the IBM JDK comes with a bunch of stuff pre-installed in the ext directory (an old version of xerces.jar, for example). Bad idea. In essence, manage your classpath explicitly and you will be glad you did. Vlad. Please respond to "Ant Users List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: Subject: Linkage error with new jspc task Hi everyone, I am using ant 1.5 alpha, to get access to the new jspc task. However, I am running into the following error when I try and execute it: BUILD FAILED C:\dev\kiosk\Design\Admin\build.xml:87: java.lang.LinkageError: loader constrain ts violated when linking org/w3c/dom/Document class Looking through the mailing list, it appears that Ant sometimes has trouble with the task loader loading classes that have already been loaded eg with crimson.jar and xerces.jar (see http://www.mail-archive.com/[email protected]/msg10847.html). The suggestion there was to use fork="true" to get it to work, but this is not an option with the jspc task. Would REALLY appreciate any help on this one! The new task will save LOADS of time by selectively reprecompiling. Do I need to replace crimson.jar with something else? Many thanks, David JSCP task: <target name="jspc"> <jspc srcdir="${build.home}\jsp" destdir="${build.home}\java" package="JspServ" verbose="9"> <include name="**/*.jsp" /> <classpath> <pathelement location="${tomcat.home}\lib\jasper-runtime.jar"/> <pathelement location="${tomcat.home}\lib\naming-factory.jar"/> <pathelement location="${tomcat.home}\lib\jasper-compiler.jar"/> <pathelement location="${tomcat.home}\common\lib\servlet.jar"/> <pathelement location="${tomcat.home}\common\lib\xerces.jar"/> <pathelement location="${src}\..\Common\jsp\Web-inf\lib\struts.jar"/> <pathelement location="${build.home}\classes"/> </classpath> </jspc> </target> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
