jastrachan | 4 Feb 08:22 2005

Re: java.lang.NoClassDefFoundError: groovy/lang/Script

This sounds bizarre - Script is pretty crucial to be able to load your 
templates. I wonder if setting the 
Thread.currentThread().getContextClassLoader() might help? If you 
really need to you can explicitly setup the class loader of GroovyShell 
/ GroovyClassLoader to explicitly specify what parent class loader to 
use to find stuff.

On 3 Feb 2005, at 13:11, Turansky, Mark wrote:

> I am using the SimpleTemplateEngine to generate some files for me.
> When I run my generator via the command line with Groovy.jar (beta 8) 
> on
> the classpath, all is well.
> When I run an Ant task to start my generator with Groovy (including ALL
> jars in my distribution via a classpath element), I get:
> java.lang.NoClassDefFoundError: groovy/lang/Script
> I imagine this has something to do with the way Groovy loads classes.
> Ant is finding all other classes well that the generator relies on.  It
> complained when I did not have Groovy.jar in the dist directory.  But
> when it runs, I get the above error.  This makes me think it's Groovy.
> My entire Ant target:
>     <target name="keystroke" depends="jar" description="Run Keystroke 
> on
> the ${application.xml} file">
>         <taskdef name="keystroke"
> classname="keystroke.ant.KeystrokeTask">
>             <classpath>
>                 <fileset dir="${dist.dir}">
>                     <include name="*.jar"/>
>                 </fileset>
>             </classpath>
>         </taskdef>
>         <keystroke applicationXml="${application.xml}"/>
>     </target>