3

I'm using start.jar and stop.jar to stop and start my jetty instance. I restart by calling stop.jar, then start.jar. The problem is, if I don't sleep long enough between stop.jar and start.jar I start getting these random ClassNotFoundExceptions and the application doesn't work correctly.

Sleeping for a longer period of time between stop and start is my current option.

I also heard from someone that I should have something that manages my threads so that I end those before jetty finishes. Is this correct? The question I have about this is that stop.jar returns immediately, so it doesn't seem to help me, unless there's something I'm missing. Another option might be to poll the log file, but that's pretty ugly.

What's the best way of restarting jetty?

Gilbert: The Ant task is definitely not a bad way of doing it. However, it sleeps for a set amount of time, which is exactly what I'm trying to avoid.

4

3 回答 3

1

你能在调用shutdown之后和调用startup之前写一个shell脚本来做这样的事情吗?

LISTEN_PORT = `netstat -vatn | 听听| grep 8080 | wc -l`
而 [$LISTEN_PORT -ne 0] ; 做
    睡觉 1
    LISTEN_PORT = `netstat -vatn | 听听| grep 8080 | wc -l`
完毕
于 2008-10-01T21:48:53.583 回答
1

该线程看起来很旧,但无论如何发布,可能会对某人有所帮助。跨平台方法:

http://ptrthomas.wordpress.com/2009/01/24/how-to-start-and-stop-jetty-revisited/

于 2009-01-24T17:22:10.510 回答
0

Did you try JFGI? Setting up Ant task that could do the work for you?

This blog post details how to setup targets that can start and stop jetty for you. You could easily cobble together another target called 'jetty-restart' which depends on 'jetty-stop' and then calls 'jetty-start'.

http://ptrthomas.wordpress.com/2006/10/10/how-to-start-and-stop-jetty-from-ant/

于 2008-09-19T16:39:42.440 回答