It's all about the answers!

Ask a question

Build error - java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher


Vijayalakshmie K Ekan (711116) | asked Nov 27 '14, 8:44 a.m.
While Request Build viaAnt Enterprise Extension  Rationa Build Agent , getting error java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher

I am working with RTCz v 4.0.1 ( RTC on System z) ,
WAS v 8.5 where RTC applications deployed
Build Engine of type Rational Build Agnet
Build Definition - Ant Enterprise Extension Rationa Build Agent

While requesting Build getting :
Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.tools.ant.launch.Launcher
* Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
*     at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
*     at java.lang.ClassLoader.loadClass(ClassLoader.java:677)
*     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
*     at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
* Could not find the main class: org.apache.tools.ant.launch.Launcher.  Program will exit.
EXEC end "/rtc4/usr/lpp/jazz/v4.0.1"@"S0W1"

I have set ANT_HOME as /rtc4/usr/lpp/jazz/v4.0.1/buildsystem/buildtoolkit and JAVA_HOME set properly.



Accepted answer


permanent link
Ryan Ruscett (1.0k413) | answered Nov 27 '14, 9:15 a.m.
Hello,

The fact that it is failing in the main thread. It's failing while loading up and launching ant. This tells me (my opinion) that ANT is not set properly. I see you set ANT_HOME to where you decompressed the ANT files? That may be correct, but have you tried adding  ${ANT_HOME}/bin  (Unix) or  %ANT_HOME%/bin  (Windows) into your PATH?

JAVA_HOME="xxx/xx/xx/xx"
ANT_HOME="/rtc4/usr/lpp/jazz/v4.0.1/buildsystem/buildtoolkit
PATH="$ANT_HOME/bin:$PATH"
	

It's not able to find the class org.apache.tools.ant.launch.Launcher which resides in the ant-launcher.jar. You Now, it's very unlikely that the ant-launcher.jar is missing a class. But you could expand it and check if the class if there. If the class is there, it's the classpath that needs adjusting. 

Could try ant --execdebug and see what the output is. Although, I have never used it.

Hope this helps.


Vijayalakshmie K Ekan selected this answer as the correct answer

One other answer



permanent link
Vijayalakshmie K Ekan (711116) | answered Dec 01 '14, 6:04 a.m.
Hi Ryan,

  I could resolve this issue, Thanks for suggestion.

I haven't included PATH, and I am working with System z ,
So i just manually searched on the .jar file correct location and then it had lib and bin.

So gave that path as ANT_HOME, now it is proceeding with compile.

Thanks, Viji

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.