wondering how i can launch tomcat from ant without ant hanging...

C

Chris Bedford

Hello, all:

I've seen this question posted a couple of times, but never with an
answer that does the trick for me.... So with all your permission,
I'll try again.

I'm trying to launch tomcat via an ant task like this ->>>


<target name="start.tomcat">
<java classname="org.apache.catalina.startup.Bootstrap"
fork="yes">
<jvmarg value="-Dcatalina.home=${dir.tomcat}"/>
<jvmarg value="-Dcatalina.base=${dir.tomcat}"/>
<arg value="start"/>
<classpath>
<fileset dir="${dir.tomcat}">
<include name="bin/bootstrap.jar"/>
</fileset>
</classpath>
</java>
<echo>yo</echo>
</target>


But although tomcat starts, it hangs ant -- ant never finishes. I
thought the 'fork' would start tomcat in a new jvm. Any
have an idea about what whackiness is afoot here ?

Some have suggested the use of the parallel task... But my
understanding of parallel is that you will see the 'yo' being
echoed... But ant will not halt until tomcat exits... which is not
what i want... i want ant to terminate and tomcat to stay around
doing its thing.

any help much appreciated ! / Chris
 
C

Chris Smith

Chris said:
I've seen this question posted a couple of times, but never with an
answer that does the trick for me.... So with all your permission,
I'll try again.

I'm trying to launch tomcat via an ant task like this ->>>


<target name="start.tomcat">
<java classname="org.apache.catalina.startup.Bootstrap"
fork="yes">

One picky thing to try: that should be fork="true". I don't know if
fork="yes" will work or not.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
C

Chris Bedford

Hi, Chris:

thanks for your advice.. I gave it a shot, but unfortunately I'm still
hanging and never seeing ant exit.

best regards,
Chris
 
C

Chris Smith

Chris said:
thanks for your advice.. I gave it a shot, but unfortunately I'm still
hanging and never seeing ant exit.

Sorry, then... I just took a quick look to see if I could see anything
obviously wrong. I don't know the answer.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
G

goliv

[snip]
I'm trying to launch tomcat via an ant task ......
......
i want ant to terminate and tomcat to stay around doing its thing.
......
[snip]

we can start the tomcat using the 'exec' task

<target name="start.tomcat">
<exec executable='${dir.tomcat}\bin\startup.bat'>
</exec>
</target>

i tried this and it worked.
 
C

Chris Bedford

response to (e-mail address removed)

thanks for your post ! I tried the same thing and it does not work
for me.
I'm running ant on windows 2k, if that makes any difference...

Here's what i tried, verbatim, this launches tomcat, then ant waits
forever:

<target name="box" >
<exec
dir="d:/temp/TOMCAT/jakarta-tomcat-4.1.24/bin/"
executable="d:/temp/TOMCAT/jakarta-tomcat-4.1.24/bin/startup.bat">
</exec>
</target


HOWEVER, I can actually suggest a solution at this point. It's
complicated, but it worked for me.

step 1) Download Bill Burton's scripts for launching ant in the
background.
details:
http://www.mail-archive.com/[email protected]/msg23641.html

step 2)

add this target to Bill's script (you will want to change the path
names
to point to where your tomcat actually lives):

<target name="exec_tomcat"
description="Asynchronous Exec in a New Window">
<exec executable="${antRunAsync}"
dir="d:/temp/TOMCAT/jakarta-tomcat-4.1.24/bin/"
vmlauncher="false"
failonerror="true">
<env key="ANTRUN_TITLE" value="${exec_title}" />
<arg line="d:/temp/TOMCAT/jakarta-tomcat-4.1.24/bin/startup.bat"
/>
</exec>
<sleep seconds="2" />
<echo message="leaving target" />
</target>


Many thanks to Bill ! he rocks.
 
A

alan.gibson

i fixed this same problem by adding spawn="true" to the exec element. i
know this works with with ant 1.6 and above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top