Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Ant Jetty plugin how-to not working for me

>>On 11/17/2010 07:38 AM, Chris Dolan wrote:
>> Using this:
>> http://docs.codehaus.org/display/JETTY/Ant+Jetty+Plugin
>>
>> build.xml
>> https://gist.github.com/702794
>>
>> ant command output:
>> https://gist.github.com/702793
>>
>> I've followed all the instructions in the document above (making
>> allowances for version differences), but can't get the example
>> working.  As you can see, I have the jetty-util jar in the classpath,
>> but at taskdef time, Ant cannot find a class file (which I've
>> confirmed is definitely in jetty-util.
>>
>> Can anyone help?
>
>ant tends to use a set of core utilities to build the CLASSPATH used to
>find its various dependencies.  If those utilities cannot find the .jar
>file containing the ant plugin, it won't be included on the CLASSPATH
>and you'll get the error you experienced.  Try debugging the
>/usr/bin/ant script, specifically the OPT_JAR_LIST .. for me, line 182
>contains a line that calls /usr/bin/build-classpath passing
>$OPT_JAR_LIST and resulting in the classpath for all those jars.
>
>I had to pull similar tricks to get the jsch stuff (for scp support in
>ant scripts) working, which I think boiled down to putting both the .jar
>file, and a soft link to it, in /usr/share/java.
>
>Nick

Thanks, Nick!

It turned out that the real problem was that I'd dropped the jetty-ant JAR file into my $ANT_HOME/lib and forgotten about it.  I found a similar Q&A on StackOverflow (http://stackoverflow.com/questions/482303/ant-cannot-find-a-class-needed-by-an-externally-defined-taskdef) that mentioned, "if the task class can be loaded by a classloader higher up in the classloader heirarchy... then your classpathref will simply get ignored".  That's exactly what happened in my case.  I removed the JAR from $ANT_HOME/lib, and now Jetty is running fine.

~Chris

Back to the top