Process fork failed - at org.testng.TestNGAntTask.executeAsForked(TestNGAntTask.java:824)

1,702 views
Skip to first unread message

Sam

unread,
Jun 29, 2012, 2:42:50 AM6/29/12
to testng-users
Hi All,

I am not sure what is the issue but my ant build script is getting
failed with below error :
My classpath is huge and I assume it is getting failed because of that
but how to solve this?

From past 6 hours I was working on this but couldn't solve, can you
please help me out?

C:\CR\uibuild.xml:76: Process fork failed.
at org.testng.TestNGAntTask.executeAsForked(TestNGAntTask.java:824)
at org.testng.TestNGAntTask.execute(TestNGAntTask.java:521)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
....
....

Below is my Ant Build.xml

<project name="Build-Jenkins" default="run" basedir=".">

<import file="build.xml"/>

<property name="uibuild.dir" location="${basedir}/source/tests/build"/
>
<property name="uilib.dir" location="${basedir}/source/tests/lib"/>
<property name="uisrc.dir" location="${basedir}/source/tests/src"/>

<taskdef resource="testngtasks" classpath="./source/tests/lib/
testng-6.4.jar"/>

<target name="setClassPath">
<path id ="classpath_jars">
<pathelement path = "${basedir}/"/>

<fileset dir = "${uilib.dir}" includes = "*.jar"/>

<fileset dir="lib/j2ee">
<include name="*.jar"/>
</fileset>

<fileset dir="source/carrentals-web/WEB-INF/src/com/CR/">
<include name="**/*.java"/>
</fileset>

</path>
<pathconvert pathsep = ";" property="test.classpath"
refid="classpath_jars"/>
</target>

<target name = "uiinit">
<mkdir dir = "${uibuild.dir}" />
</target>

<target name = "uiclean">
<delete dir ="${uibuild.dir}"/>
</target>

<target name="uicompile" depends="uiclean, uiinit, setClassPath"
description="compile the source " >

<antcall target="compile" />

<echo message=" Now running Run target with Class Path: $
{test.classpath}:${build.dir}"/>
<javac srcdir="${uisrc.dir}" destdir="${uibuild.dir}" debug="true">
<classpath>
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>

<fileset dir="lib/j2ee">
<include name="*.jar"/>
</fileset>
<fileset dir = "${uilib.dir}" includes = "*.jar"/>
</classpath>
<include name="**/*.java"/>
</javac>
</target>

<target name="run" depends="uicompile"
description="run the testng xml file">
<testng classpath = "${test.classpath};${uibuild.dir}">
<xmlfileset dir="${basedir}/source/tests" includes = "testng.xml" /
>
</testng>
</target>
</project>

Amit singh

unread,
Oct 10, 2012, 10:45:07 AM10/10/12
to testng...@googlegroups.com
This may be because your M2_REPO directory have so many jars and may exceeds the classpath size or something like that.

The same problem I faced and resolved by extracting relevant jars to some other location and given that path only.

I hope that would work for you.

Thanks
-AMIT

Madiraju K Chaitanya

unread,
Feb 2, 2016, 10:02:19 PM2/2/16
to testng-users
Hi Amit Singh Ji,
Your solution for the above problem worked for me, by removing unnecessary jar files and also shortening the classpath where the files are located.
Thank You.
Reply all
Reply to author
Forward
0 new messages