| From | Sent On | Attachments |
|---|---|---|
| Russel Winder | Apr 25, 2008 3:15 am | |
| Jochen Theodorou | Apr 25, 2008 3:29 am | |
| Russel Winder | Apr 26, 2008 12:40 am | |
| Paul King | Apr 26, 2008 2:27 am | |
| Paul King | Apr 26, 2008 2:47 am | |
| Russel Winder | Apr 26, 2008 3:24 am | |
| Jochen Theodorou | Apr 26, 2008 4:35 am | |
| Russel Winder | Apr 26, 2008 4:46 am | |
| Russel Winder | Apr 26, 2008 5:02 am | |
| Jochen Theodorou | Apr 26, 2008 5:24 am | |
| Paul King | Apr 26, 2008 5:33 pm | |
| Jochen Theodorou | Apr 27, 2008 2:10 am | |
| Paul King | Apr 27, 2008 4:26 am | |
| Russel Winder | Apr 27, 2008 4:30 am | |
| Jochen Theodorou | Apr 27, 2008 4:53 am | |
| Russel Winder | Apr 27, 2008 5:55 am | |
| Jochen Theodorou | Apr 27, 2008 6:24 am | |
| Russel Winder | Apr 27, 2008 10:43 am | |
| Jochen Theodorou | Apr 27, 2008 12:02 pm | |
| Paul King | Apr 27, 2008 4:11 pm | |
| Russel Winder | May 1, 2008 2:16 am | |
| Jochen Theodorou | May 2, 2008 10:02 am | |
| Russel Winder | May 2, 2008 12:07 pm | |
| Jochen Theodorou | May 2, 2008 12:51 pm |
| Subject: | Re: [groovy-dev] [Fwd: XML class lookup problem in Gant] | |
|---|---|---|
| From: | Jochen Theodorou (blac...@gmx.org) | |
| Date: | Apr 26, 2008 5:24:19 am | |
| List: | org.codehaus.groovy.dev | |
Russel Winder schrieb: [...]
The problem is there unless you put xercesImpl.jar and xml-apis.jar into $GROOVY_HOME/lib. No other place works, they have to go in there.
I must confess I don't get why.How does your groovy-starter.conf look like?
hmm... I just had an crazy idea for a total hack. Could anyone (I have only Ubuntu atm) try this patch:
""" Index: groovy/src/main/org/codehaus/groovy/tools/RootLoader.java =================================================================== --- groovy/src/main/org/codehaus/groovy/tools/RootLoader.java (revision 12127) +++ groovy/src/main/org/codehaus/groovy/tools/RootLoader.java Sat Apr 26 13:21:40 CEST 2008 @@ -82,6 +82,10 @@ */ public RootLoader(URL[] urls, ClassLoader parent) { super(urls, parent); + // major hack here...! + try{ + super.loadClass("org.w3c.dom.Node",false); + } catch (Exception e) {} }
private static ClassLoader chooseParent() { """
the idea is that I ask the parent loader for this class, if the parent loader has this class, then it should appear when "this.findLoadedClass(name);" in loadClass with the right loader. Then the class can no longer violate the loader constraints... a different class might den do so, but that's another story then
I'm afraid I have now run out of time to try this now, maybe tomorrow morning.
well, anyone is fine. I just need to know if it works this way. If it does, then I might have an ideas about what we can do
I think xml-apis.jar might be a red herring in this case -- but maybe not.
yes, I am sorry, it is not the xml-apis.jar that is causing this, it is the jaxen.jar on the groovy side which causes this.
On the other hand putting xercesImpl.jar and xml-apis.jar in $GROOVY_HOME/lib solves all the problems.
~/.groovy/lib doesn't work it has to be $GROOVY_HOME/lib
if you put these jars there, then you usually get other problems. This time ClassCastException, because sometimes the JDK classes are loaded and sometimes the ones from RootLoader.
The point is that Ant works fine and Gant gets a java.util.LinkageError when trying to do the self same thing. Gant has no classloader tricks, only MOP usage.
it uses RootLoader, or not?
Yes, for the caching stuff Graeme added and also for the Ant library and extras loading.
well, then Gant has class loader tricks ;)
I only mentioned xml-apis.jar because someone said that if they copied the Ivy version of this jar into a directory so that it got searched first by java on start-up then the problem went away for their use of Ivy in Gant.
removing the jaxen.jar from the groovy lib would solve the problem too.
I don't have jaxen.jar in $GROOVY_HOME/lib
oh.. ok.
[...]
So perhaps the issue here is that Gant loads all the Ant jars and does this using the Groovy Rootloader because it is a Groovy program.
don't mix things here. RootLoader is not required for a Groovy program. RootLoader does only the classpath setup. In embedded mode Groovy usually runs without RootLoader.
So on Ubuntu this is the same jar as used by java whereas on Mac OS X and Solaris it is not. If this is the case then the only way of properly removing the problem is to recode all of Gant in Java.
no, you could also remove RootLoader
I guess that may be an option. However, it is clear that there is a deeper problem here that may require more than just a hack solution.
the deeper problem is, that if you have two classes of the same name in different jars, that these classes should be loaded by the same loader or only one of these classes. If not it will cause problems. If the classes are more or less the same, then loading one or the other doesn'tmatter, just don't load both of it. If the classes are different enough (for example the code accesses a method on that class, that does not exist on the other class), then you will get the JVM messages equal to MissingMethodException. And If you cast the other class to your class, then yo will get a ClassCastException... but of the class is loaded by one time bypassing the loader and the other time not and the other time the loader will not return what would be returned if it was bypassed, then you will get that stupipd LinkageError.
And yes, we all of these errors already at one time or another.
bye blackdrag
-- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead (http://groovy.codehaus.org) http://blackdragsview.blogspot.com/ http://www.g2one.com/
--------------------------------------------------------------------- To unsubscribe from this list, please visit:





