tags:

views:

29

answers:

1

I have a problem when I run Jetty task with my war file.

Here is my output:

[jetty] Configuring Jetty for project: Guardian
[jetty] 2010-08-23 18:53:09.062:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
[jetty] 
[jetty] Configuring Jetty for web application: project
[jetty] Webapp source directory = C:\Projects\GUARDIAN\build\dist\project.war
[jetty] Context path = /
[jetty] Classpath = []
[jetty] Default scanned paths = []
[jetty] Extra scan targets = []
[jetty] Temp directory = C:\jettyTemp\
[jetty] 2010-08-23 18:53:09.391:INFO::jetty-6.1.25
[jetty] 2010-08-23 18:53:09.481:INFO::Extract C:\Projects\GUARDIAN\build\dist\project.war to C:\jettyTemp\webapp
[jetty] 2010-08-23 18:53:13.810:INFO::NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
[jetty] 2010-08-23 18:53:13.909:INFO::No Transaction manager found - if your webapp requires one, please configure one.
[jetty] 2010-08-23 18:53:18.038:INFO::Started [email protected]:8080

and it hangs forever.

What can I do about it? The goal is to start jetty with this war file so I can continue testing.

A: 

You did not show us how you start Jetty, but I'll assume you use either <java> or <exec> task.

With ether task you need to specify the following attributes:

<java
  fork="true"
  spawn="true"
>
  ...
</java>

spawn is really the one that detaches from the ant execution thread and allows ant to continue and not wait for the task to complete ( the behavior you currently experiencing ).

Because ant is not very well suited for inter-process communications, your only option after spawning is to give a long enough <sleep> task, so Jetty can start and initialize properly and be ready for your tests.

BTW, once you spawn the process that way you will not be able to stop it easily. I am not familiar with Jetty configuration and do not know if it is possible to shut it down easily, by sending a kill command to some TCP port ( that's how you can shutdown instance of Tomcat for example ).

Alexander Pogrebnyak
hi Alexander, thanks for answer I am using Jetty ant task thats how i start jetty inside build <path id="jetty.plugin.classpath"> <fileset dir="${lib.testjetty}" includes="*.jar"/> </path> <jetty tempDirectory="${jetty.temp}"> <webApp name="project" warfile="${build.dist}/${websvc.install}.${locale}.${project.version}.war" contextpath="/" /> </jetty> Maybe you know how I can do spawn and sleep by using this?
Kate Khapatko