Build error - java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
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.
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
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.