I am new to a java project. I have been asked to terminate the server once web application throws http exception. I dont understand how to retrieve the ongoing server and then stop it through java code. In the project both glassfish and apache tomcat are being used. Would I need to stop the apache tomcat server or the glassfish server and how? Thanks
Asked
Active
Viewed 59 times
1 Answers
0
Normally if you find serious system problem you only need to restart the apache tomcat (step b). But if you want to restart glassfish, please following (step a) below:
(Step a) Restart the domain by using the restart-domain(1) subcommand.
e.g.
restart-domain mydomain4
or thru a browser
http://yourhost:4848/__asadmin/restart-domain
(Step B) For restarting apache tomcat
systemctl restart identity_tomcat.service

Ken Lee
- 6,985
- 3
- 10
- 29
-
thanks for your response. Actually I am looking for how to stop the server through the java code. Would I need any plugins and what syntax to use.. – Manisha Veeranki Dec 17 '20 at 08:27
-
Oh you want to use java codes to do this instead of commands in console ? Then please refer to this link https://stackoverflow.com/questions/48109709/restart-tomcat-with-java – Ken Lee Dec 17 '20 at 08:31