开发者

How to check if Tomcat runnning using Embedded Tomcat

In reference with one of the articles: Howto embed Tomcat 6?

I understood how to embed tomcat in a java application. Thanks for that. However I need to know if there is any elegant method provided by org.apache.catalina.startup.Embedded to check if the container is already started or not?开发者_高级运维

For example, if I create a batch file for the example given in the link above and click it twice; second time it would fail with JVM_BIND error; tomcat is running.

Please help.


You could use the example code given on the Tomcat wiki

http://wiki.apache.org/tomcat/HowTo#How_do_I_check_whether_Tomcat_is_UP_or_DOWN.3F_There_is_no_status_command

Note: This doesnt use Embedded

It is trying to connect to the Tomcat ip:port and seeing if it responds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜