• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Terminate a web application.

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way to terminate a web application without calling System.exit(). Basically, if there are some invalid properties/etc during initialization of the web app, we would like to force the application to shut down or not run. Calling System.exit is obviously risky in a shared container.

Thx in advance.
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The servlet's init function can throw an exception to indicate that it cannot be loaded. Check the docs.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Calling System.exit is obviously risky in a shared container.



"risky"? Try completely idiotic.

Throw an UnavailableException. The container will catch it and take the servlet out of service.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instead of System.exit() some people have found handgranades and RPGs to be quite effective.
Minor problem is the refusal of the application or indeed the server to start afterwards

Simplest option is to reload the web application using your server's administration console or whatever it uses for the task.
 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
go to your tomcat page (localhost:8080), click on Manager, type in your username and password (located in $CATALINA_HOME/conf/users.xml) for admin. There you will see list of application. You can stop, start, restart, and undeploy them. What you're looking for is stop.
 
Wes Hughes
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all the answers but I'm really looking for programmatic solutions along the line of the first two.
 
reply
    Bookmark Topic Watch Topic
  • New Topic