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

Discussion in 'Java' started by Chris Bedford, Jul 29, 2003.

  1. 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
     
    Chris Bedford, Jul 29, 2003
    #1
    1. Advertising

  2. Chris Bedford

    Chris Smith Guest

    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
     
    Chris Smith, Jul 29, 2003
    #2
    1. Advertising

  3. 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
     
    Chris Bedford, Jul 29, 2003
    #3
  4. Chris Bedford

    Chris Smith Guest

    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
     
    Chris Smith, Jul 30, 2003
    #4
  5. Chris Bedford

    Guest

    [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.
     
    , Jul 30, 2003
    #5
  6. response to

    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//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.
     
    Chris Bedford, Jul 30, 2003
    #6
  7. Chris Bedford

    Guest

    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
    >
    > 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//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.
     
    , Dec 23, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt Swift
    Replies:
    1
    Views:
    350
    =?Utf-8?B?TG95IEIgSw==?=
    May 27, 2004
  2. Ben Parrish
    Replies:
    0
    Views:
    619
    Ben Parrish
    Aug 6, 2003
  3. Jase

    Tomcat Hanging

    Jase, Oct 26, 2003, in forum: Java
    Replies:
    5
    Views:
    2,823
  4. Rogan Dawes

    ANT and xslt task hanging

    Rogan Dawes, Apr 14, 2005, in forum: Java
    Replies:
    0
    Views:
    434
    Rogan Dawes
    Apr 14, 2005
  5. frank
    Replies:
    4
    Views:
    420
    s_m_b
    Dec 7, 2004
Loading...

Share This Page