You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Stefan Schmitt <ss...@raleigh.ibm.com> on 2000/11/23 09:52:57 UTC

Fork problem with AIX

Hello

I have a nice build environment which works on Win2000. But it have to work
on AIX. We use the Ant <java> task to execute a class.

<java classname="addclass" fork="yes" args="${src}/install.class
${dst}/install.class *.class *.gif *.lst *.dll *.script *.ico *.txt *.zip"/>

The problem is that we get an JavaIOException from UnixForkandExec on AIX.
If we do not use the fork attribute it seams as if the args attribute is not
recognized. Java 1.2.2 and Ant 1.2 (the GA version) are used.
Perhaps I have only to use the deprecated <arg> or call the class file by
the exec task.

Any suggestions?
Yours
Stefan S


Re: Fork problem with AIX

Posted by Stefan Bodewig <bo...@apache.org>.
Stefan Schmitt <ss...@raleigh.ibm.com> wrote:

> Yes this works. I copied it to the shell and it worked fine. It is
> not logic. This java task is not the only in my build and the other
> work all fine. But this is the only <java> task which is forked.  I
> have changed my build workflow to. It`s not fine but now it
> works. Now my build looks the following
> 
> 1. set environment
> 2. call Ant (First Part)
> 3. call addclass from the script

after changing the dir?

> 4. call Ant (Second Part)
> 
> Thanks for your posting.

you're welcome.

> If you have some points which I could try or things which I should
> check tell them to me and I will tell you if I find what this
> problem causes.

Not really, a snippet of "ant -verbose" as well as the part of your
build file that doesn't work - together with the script that works - might
help getting closer to it.

Stefan

Re: Fork problem with AIX

Posted by Stefan Schmitt <ss...@raleigh.ibm.com>.
Yes this works. I copied it to the shell and it worked fine. It is not
logic. This java task is not the only in my build and the other work all
fine. But this is the only <java> task which is forked.
I have changed my build workflow to. It`s not fine but now it works. Now my
build looks the following

1. set environment
2. call Ant (First Part)
3. call addclass from the script
4. call Ant (Second Part)

Thanks for your posting. If you have some points which I could try or things
which I should check tell them to me and I will tell you if I find what this
problem causes.

Yours
Stefan S



Re: Fork problem with AIX

Posted by Stefan Bodewig <bo...@apache.org>.
Stefan Schmitt <ss...@raleigh.ibm.com> wrote:

>> What does it do? What do you expect? What is wrong?
> 1. It creates a file with the name install.class
> 
> 2. I expected that it should create this class and add some
> recources to this class. I mean that finaly the install.class file
> is a large binary file which bases upon the original install.class
> file but also includes all needed recources. (Some gifs, class and
> zip files which it needs during installation.
> 
> 3.Wrong? I only get a copy of the original file.
> 
> I tried it with <exec> and <java>. But everytime the same result.
> 
> The problem of the addclass Class is that I define which files
> should be added to a classfile. This filter refers to the directory
> where addclass is called from. I used the dir attribute of <exec>
> and of <java> but I does not get my expected output. Could you
> explain how the dir attribute works or if there is something else
> which changes the current working directory.

Basically dir causes a "cd dir" before the command is executed (which
will not work when using <java> in no-fork mode).

Maybe you are passing relative filenames to the command and they don't
get resolved relative to the directory you want them to refer to?

Does the command line that ant -verbose shows work when you invoke it
inside the specified dir?

Stefan

Re: Fork problem with AIX

Posted by Stefan Schmitt <ss...@raleigh.ibm.com>.
> What does it do? What do you expect? What is wrong?
1. It creates a file with the name install.class

2. I expected that it should create this class and add some recources to
this class. I mean that finaly the install.class file is a large binary file
which bases upon the original install.class file but also  includes all
needed recources. (Some gifs, class and zip files which it needs during
installation.

3.Wrong? I only get a copy of the original file.

I tried it with <exec> and <java>. But everytime the same result.

The problem of the addclass Class is that I define which files should be
added to a classfile. This filter refers to the directory where addclass is
called from. I used the dir attribute of <exec> and of <java> but I does not
get my expected output. Could you explain how the dir attribute works or if
there is something else which changes the current working directory.

Stefan S.



Re: Fork problem with AIX

Posted by Stefan Bodewig <bo...@apache.org>.
Stefan Schmitt <ss...@raleigh.ibm.com> wrote:

> Oh sorry I forgot to copy the bin directory to the Ant
> directory. Now the exception is gone but the class doesn't work.  I
> call the class file but this does not the same as if I call it from
> the command line.

What does it do? What do you expect? What is wrong?

Stefan

Re: Fork problem with AIX

Posted by Stefan Schmitt <ss...@raleigh.ibm.com>.
Oh sorry
I forgot to copy the bin directory to the Ant directory. Now the exception
is gone but the class doesn't work.
I call the class file but this does not the same as if  I call it from the
command line.


Re: Fork problem with AIX

Posted by Stefan Bodewig <bo...@apache.org>.
Stefan Schmitt <ss...@raleigh.ibm.com> wrote:

>> >
>> > /home/Ant/wep/tools/installer/src/build.xml:28: Execute failed:
>> > java.io.IOException: /home/Ant/Ant/bin/antRun: not found
>>
>> Did you set ANT_HOME to /home/Ant/Ant? Are you using the ant script
>> that comes with Ant or are you invoking Ant with a script of your
>> own?
> 
> I set ANT_HOME to /home/Ant/Ant in my own script file which invokes
> Ant. I do not use the script that comes with Ant.

Then make sure your invocation of Ant includes -Dant.home=$ANT_HOME.

Setting ANT_HOME doesn't help unless you use Ant's own wrapper script,
because you cannot access the environment variable from within the
JVM. The wrapper script does exactly what I've said above.

> I think that the Runtime class mighty be the problem or is it
> possible that I have to set some special permissions to allow
> forking on AIX?

Don't think so. The message quite clearly says it couldn't find
/home/Ant/Ant/bin/antRun (which obviously means Ant knows ANT_HOME,
silly me). Does this file exist? Is it executable for the user that is
invoking Ant?

Stefan

Re: Fork problem with AIX

Posted by Stefan Schmitt <ss...@raleigh.ibm.com>.
> >
> > /home/Ant/wep/tools/installer/src/build.xml:28: Execute failed:
> > java.io.IOException: /home/Ant/Ant/bin/antRun: not found
>
> Did you set ANT_HOME to /home/Ant/Ant? Are you using the ant script
> that comes with Ant or are you invoking Ant with a script of your own?

I set ANT_HOME to /home/Ant/Ant in my own script file which invokes Ant. I
do not use the script that comes with Ant. I think that the Runtime class
mighty be the problem or is it possible that I have to set some special
permissions to allow forking on AIX?
Do you think I should install java 1.3 and try it again?

yours
Stefan S



Re: Fork problem with AIX

Posted by Stefan Bodewig <bo...@apache.org>.
Stefan Schmitt <ss...@raleigh.ibm.com> wrote:

> Ok with the exec task the same error occurs. Now I post the
> exception
> 
> [exec] The command attribute is deprecated. Please use the
> executable attribute and nested arg elements.
> 
> BUILD FAILED
> 
> /home/Ant/wep/tools/installer/src/build.xml:28: Execute failed:
> java.io.IOException: /home/Ant/Ant/bin/antRun: not found

Did you set ANT_HOME to /home/Ant/Ant? Are you using the ant script
that comes with Ant or are you invoking Ant with a script of your own?

Stefan

Re: Fork problem with AIX

Posted by Stefan Schmitt <ss...@raleigh.ibm.com>.
Ok with the exec task the same error occurs. Now I post the exception

[exec] The command attribute is deprecated. Please use the executable
attribute and nested arg elements.

BUILD FAILED

/home/Ant/wep/tools/installer/src/build.xml:28: Execute failed:
java.io.IOException: /home/Ant/Ant/bin/antRun: not found
java.io.IOException: /home/Ant/Ant/bin/antRun: not found
 at java.lang.UNIXProcess.forkAndExec(Native Method)
 at java.lang.UNIXProcess.<init>(UNIXProcess.java:138)
 at java.lang.Runtime.execInternal(Native Method)
 at java.lang.Runtime.exec(Runtime.java:275)
 at
org.apache.tools.ant.taskdefs.Execute$CommandLauncher.exec(Execute.java:325)
 at
org.apache.tools.ant.taskdefs.Execute$CommandLauncherProxy.exec(Execute.java
:431)
 at
org.apache.tools.ant.taskdefs.Execute$ScriptCommandLauncher.exec(Execute.jav
a:541)
 at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:247)
 at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:213)
 at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:154)
 at org.apache.tools.ant.Target.execute(Target.java:133)
 at org.apache.tools.ant.Project.runTarget(Project.java:818)
 at org.apache.tools.ant.Project.executeTarget(Project.java:510)
 at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:213)
 at org.apache.tools.ant.Target.execute(Target.java:133)
 at org.apache.tools.ant.Project.runTarget(Project.java:818)
 at org.apache.tools.ant.Project.executeTarget(Project.java:532)
 at org.apache.tools.ant.Project.executeTargets(Project.java:506)
 at org.apache.tools.ant.Main.runBuild(Main.java:420)
 at org.apache.tools.ant.Main.main(Main.java:149)

Total time: 6 minutes 42 seconds

Does anyone have an idea
Yours
Stefan S