You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Keith Hatton <kh...@axiomsystems.com> on 2004/02/13 11:36:30 UTC

Waiting for server to start

Hi all,

Part of my build file starts an application server, performs test cases against it, and shuts down the server. I'm successfully using the <parallel> task to achive this, conceptually like so:

        |
  +-----+-----+
  |           |
start       wait
  |           |
  |        run tests
  |           |
  |         stop
  |           |
  +-----+-----+
        |


My problem is the "wait" part. I have been using <waitfor> and <url> to check for the app server's URL, but recently I have noticed that sometimes the URL is available before the server initialisation has really completed, which can lead to spurious test failures, and (for very small projects) even the possibility that the "stop" task is called before the server has really started.

The server is JBoss, and strictly I should be checking the server output for a text string. Any ideas on the best way to do this?

(Current "start" target):
            <echo>Starting JBoss ...</echo>
            <exec dir="${jboss.home}/bin" executable="cmd.exe" os="Windows 2000" output="jboss.out">
                <arg line="/c run.bat"/>
                <env key="NOPAUSE" value="true"/>
            </exec>
            <echo>JBoss has stopped</echo>

(Current "wait" target ... the <sleep> is a hack to work around the problem):
            <echo>Waiting for JBoss ...</echo>
            <waitfor maxwait="120" maxwaitunit="second" checkevery="20" checkeveryunit="second">
                <http url="http://localhost:8080/jmx-console"/>
            </waitfor>
            <sleep seconds="10"/>
            <echo>JBoss has started</echo>


Thanks for any suggestions
Keith

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Waiting for server to start

Posted by Jonathan Woods <jo...@croftonpark.com>.
How about a combination of the <get> and <loadfile> tasks?

-----Original Message-----
From: user-return-41043-jonathan.woods=croftonpark.com@ant.apache.org
[mailto:user-return-41043-jonathan.woods=croftonpark.com@ant.apache.org] On
Behalf Of Keith Hatton
Sent: 13 February 2004 10:37
To: Ant-User (E-mail 2)
Subject: Waiting for server to start


Hi all,

Part of my build file starts an application server, performs test cases
against it, and shuts down the server. I'm successfully using the <parallel>
task to achive this, conceptually like so:

        |
  +-----+-----+
  |           |
start       wait
  |           |
  |        run tests
  |           |
  |         stop
  |           |
  +-----+-----+
        |


My problem is the "wait" part. I have been using <waitfor> and <url> to
check for the app server's URL, but recently I have noticed that sometimes
the URL is available before the server initialisation has really completed,
which can lead to spurious test failures, and (for very small projects) even
the possibility that the "stop" task is called before the server has really
started.

The server is JBoss, and strictly I should be checking the server output for
a text string. Any ideas on the best way to do this?

(Current "start" target):
            <echo>Starting JBoss ...</echo>
            <exec dir="${jboss.home}/bin" executable="cmd.exe" os="Windows
2000" output="jboss.out">
                <arg line="/c run.bat"/>
                <env key="NOPAUSE" value="true"/>
            </exec>
            <echo>JBoss has stopped</echo>

(Current "wait" target ... the <sleep> is a hack to work around the
problem):
            <echo>Waiting for JBoss ...</echo>
            <waitfor maxwait="120" maxwaitunit="second" checkevery="20"
checkeveryunit="second">
                <http url="http://localhost:8080/jmx-console"/>
            </waitfor>
            <sleep seconds="10"/>
            <echo>JBoss has started</echo>


Thanks for any suggestions
Keith

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org