We have some testing code that starts a Tomcat/Axis server in one jvm, then sends test soap calls from a different jvm. To avoid having the client test code send soap calls before Axis is ready we have added a ServletContextListener to the Axis server code:
public class StartupListener implements ServletContextListener { private static Logger mLogger = Logger.getLogger(StartupListener.class); public void contextInitialized(ServletContextEvent event) { WsrServer.setServletRunning(true); mLogger.info("axis has been marked as running"); } public void contextDestroyed(ServletContextEvent event) { WsrServer.setServletRunning(false); mLogger.info("the servlet has stopped"); } } and noted it in Tomcat's web.xml file: <listener> <listener-class> com.realmsys.wsr.server.wsrserver.StartupListener </listener-class> </listener> Is there a simpler way? For instance, if Tomcat/Axis were clever enough to begin listening on 8080 only _after_ Axis was completely initialized, we would not need the above code. Instead we could just connect to 8080 and, if the connect succeeded, start sending soap calls. However, if Tomcat begins listening _before_ Axis is ready, then a race condition exists where calls could be sent, but could not succeed. Does anyone have a definitive answer? Thanks, -- Robert