Though it's super late, thought of sharing using JMX to get the application deployment status.
https://github.com/amitlpande/java-utils/blob/master/ApplicationeploymentCheckerValve.java https://github.com/amitlpande/java-utils/blob/master/server.xml Appreciate reviews/comments. Thanks, Amit -----Original Message----- From: Bruno Melloni <x.tomc...@melloni.com> Sent: Saturday, September 30, 2023 8:32 AM To: users@tomcat.apache.org Subject: [External] Re: Best way to *programmatically* detect that all webapps are fully deployed and running? CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. If you believe this is a phishing email, use the Report to Cybersecurity icon in Outlook. Thanks, * I really like the idea of either using JMX (although I am not yet familiar with it) or always implementing a health check endpoint for each REST service. * What would I use to query the list of *all* webapps (already up and running or not) on the tomcat server? B. On 9/30/2023 7:42 AM, Mark Thomas wrote: > On 29/09/2023 20:20, Bruno Melloni wrote: >> On a tomcat server I have a number of REST services deployed as WARs. >> There are interdependencies and even applications on other servers >> that call them, so I really don't want to start calling services >> after starting Tomcat until every single webapp is fully up and running. >> >> Ideally, I would like to do it*programmatically*. >> >> QUESTIONS >> >> * Is there a REST, other kind of API that I can call or a library >> that >> I can use? > > You could check the status of each application via JMX. > >> * Is there a known best practice on how to accomplish what I am >> looking for? Perhaps a third party library that does the job? > > Nothing comes to mind. > >> Things I know I can try, but none is an ideal solution: >> >> * Manually look at the logs. >> * Manually look at the Tomcat Application Management page. >> * Programmatically call the Tomcat Application Management page and >> scrape the information I need from it. >> * Scour through the code of the Tomcat Application Management page >> and >> replicate the pieces that I need, for example someone mentioned >> in a >> forum that I can look at >> org.apache.catalina.manager.ManagerServlet.isDeployed(String name) >> to find out whether a webapp has been deployed or not. > > If you are going the bespoke route, I'd suggest a health check / > status endpoint for each app and call them in turn. It could easily be > a standard component you deploy as part of each application. > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org