Java Mailing List Archive

http://www.gg3721.com/

Home » eclipse-plugin-dev.groovy »

[groovy-eclipse-plugin-dev] eclipse plugin classloading woes

Andrew Eisenberg

2009-04-20

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi all,

I've been trying all day to get the Groovy Eclipse Plugin to compile
the groovy compiler itself. However, it is failing. After a very
long time of trying to figure out why, I've come across this line:

return new URLClassLoader( getClassPathAsUrls(),
org.codehaus.groovy.plugin.Activator.class.getClassLoader() );

This says that the classloader that is being used for compilation of
the project should use the classpath of the project and if the desired
class isn't found there it should ask its parent classloader, which is
set to the plugin that contains the groovy compiler.

This is fine in most situations, but there is a problem when trying to
compile the compiler. This is a little complicated (and I barely
understand this myself), so I am going to do my best to explain and
maybe some classloader genius can help me out.

At some point in the compilation process, presumably during when the
stubs of Groovy files are being created there is a groovy class that
has a dependency to a Java class that has not been created yet. In
this case, it is AbstractHttpServletTest.

The GroovyClassLoader is asked to look up the class. It really
*shouldn't* exist, but since the line above sets the parent
classloader to be the groovy compiler's (the compiler that is being
used as the plugin) classloader, the class is actually found.

This is a compiled version of the class. And when it is found, a
NoClassDefFoundError is generated. Now, I'm not entirely sure of the
reason for the NoClassDefFoundError. It may be because of OSGi
scoping rules or something.

Any thoughts on what is going on here? Or how I can avoid this?

any help is appreciated.
--a

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.