You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bruno Melloni <x....@melloni.com> on 2023/09/29 19:20:31 UTC

Best way to *programmatically* detect that all webapps are fully deployed and running?

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?
   * Is there a known best practice on how to accomplish what I am
     looking for?  Perhaps a third party library that does the job?


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.


Thanks,


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Best way to *programmatically* detect that all webapps are fully deployed and running?

Posted by Bruno Melloni <x....@melloni.com>.
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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Re: Best way to *programmatically* detect that all webapps are fully deployed and running?

Posted by Mark Thomas <ma...@apache.org>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org