Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > wondering how i can launch tomcat from ant without ant hanging...

Reply
Thread Tools

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

 
 
Chris Bedford
Guest
Posts: n/a
 
      07-29-2003
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
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      07-29-2003
Chris Bedford wrote:
> 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
 
Reply With Quote
 
 
 
 
Chris Bedford
Guest
Posts: n/a
 
      07-29-2003
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
 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      07-30-2003
Chris Bedford wrote:
> 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
 
Reply With Quote
 
goliv@jataayusoft.com
Guest
Posts: n/a
 
      07-30-2003
[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.
 
Reply With Quote
 
Chris Bedford
Guest
Posts: n/a
 
      07-30-2003
response to http://www.velocityreviews.com/forums/(E-Mail 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/ant-user.../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.
 
Reply With Quote
 
alan.gibson@gmail.com
Guest
Posts: n/a
 
      12-23-2004
i fixed this same problem by adding spawn="true" to the exec element. i
know this works with with ant 1.6 and above.

Chris Bedford wrote:
> response to (E-Mail 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/ant-user.../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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jakatra tomcat- Ant - Apache tomcat - Difference ? Oom Computer Support 1 10-08-2007 05:13 PM
Jakatra tomcat- Ant - Apache tomcat - Difference ? Oom Computer Support 0 10-08-2007 02:38 PM
error runing ant in eclipse ant view yihucd@gmail.com Java 1 03-07-2006 08:39 PM
Launch a class on tomcat startup ramprasad.madathil@gmail.com Java 2 11-08-2005 06:32 AM
trouble with Hibernate and Ant (probably just Ant) john martin Java 2 04-07-2005 09:27 PM



Advertisments