Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Waiting for server to start

Waiting for server to start

2004-02-13       - By Keith Hatton
Reply:     1     2     3     4     5     6  

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@(protected)
For additional commands, e-mail: user-help@(protected)



©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.