Tomcat shuts down automatically

Go To StackoverFlow.com

16

I'm using Apache and Tomcat on a Windows server and since this morning, Tomcat stops working without any logs. It doesn't hang, it just shut down.
There's no log in Tomcat, the CPU/Memory are fines, there are no System.Exit in my code.

Anybody ever had this problem?

It happens at random, after 5-10 minutes. The application responds normally and sometime, boom.. stops working.

UPDATE : Still no clue. The Admin team will install the webapp on another box...

2009-06-16 20:17
by NoName
possible duplicate of Tomcat stopped without any log or any stackankitjaininfo 2013-11-07 10:24
Try debugging bin folder. Something apache tomcat require must not be present. I copied another working tomcat bin folder and it started working - Anuj Sharma 2017-01-15 11:23
@AnujSharma how to debugg bin folder - KJEjava48 2019-02-04 12:35
@supersheep me also having the same problem.Are u able to solve this? - KJEjava48 2019-02-04 12:36


6

I had this problem, and I found the cause at this link. My script to start tomcat had last line tail -f catalina.out. Sometime I did not kill this script, the shell then timed out and killed the script with all child processes, including tomcat.

2015-07-07 21:41
by vierab
Thank you, this was also my problem - Pali 2017-07-14 06:48
@Rory McCrossan: I have same issue with little variation, tomcat is not shutting down every 5-10 mins but randomly some times. I didn't understand your solution. I start my tomcat from startup.sh file. Please suggest what to do - Sumit 2017-07-20 17:23
@Sumit I only edited the format of the answer - you may want to ask vierab instea - Rory McCrossan 2017-07-20 19:58
@vierb or @ any other tomcat expert: the given link is now broken. could you please elaborate your answer further. check if you can remember and recall what you read on the given linked page - Ravinder Reddy 2018-11-16 05:25
Link is broken - Naive 2019-01-03 06:46
The link was there more for a credit of the problem cause. The cause of the issue is described in the answer text right after the lin - vierab 2019-01-04 15:25
@vierab where was this line "tail -f catalina.out" in u r case.Can u specify that file.How do u solved this problem.Can u elaborate u r answe - KJEjava48 2019-02-04 13:02


5

This sounds like the JVM is crashing. Have you looked for a JVM crash log? It typically has a name like hs_err_pid*.log and is created in the JVM's working directory.

If you find a file like this and upload it, then we can probably help more.

Some questions:

  • Have you recently changed the version of Java you are using?
  • What is the exact version of Tomcat you are using?
  • Are you using Tomcat Native (the Apache Portable Runtime)?
2009-06-16 20:33
by Matt Solnit
I use to have it with a combination of Java 1.4.2 and FreeBSD 5.7 (don't ask me why we had this OS for running Java) - every time there was a NullPointerException, the JVM got segmentation fault - David Rabinowitz 2009-06-16 20:41
I'm using 6.0.18 The Java version is the same since we installed the project We're not using Tomcat Native I'm going to look for a hserrpid*.log (I don't have direct access to the prod server)... Where should it be on a Windows box - NoName 2009-06-16 20:43
no hserrpid. was found on the box : - NoName 2009-06-16 21:13
In case of OpenJDK the crash logs could look like /tmp/jvm-*/hs_error.log - Michael Manner 2015-04-10 20:44
@Matt Solnit Where should be the hserrpid*.log file located in linux server?? - KJEjava48 2017-06-16 11:11


2

Recently I had this problem, If somebody faces the same issue in future I hope this will help.

Scenario: Tomcat shuts down without any logs or errors

Root Cause for my problem: synchronized method accessed from a task using TimerTask

I had a singleton class with a synchronized method accessed from various threads based on timer or user action some times this method will take up to few minutes to complete. When TimerTask is waiting on this method for sometime (I guess timer is timed out /thread is killed or something is happening in the background) and the moment the lock on the method is released the tomcat is getting killed.

So I removed synchronized keyword and removed singleton and made some code changes for thread safety. Then the problem is gone.

How I found out: I had a log statement in the first line of synchronized method and everytime the tomcat shutdowns i found this message in the last few lines.

Regards, Phanindra Kasturi

2013-01-30 13:09
by Phanindra


1

things to look for in debugging an issue like this:

  • Look at the logs directory ($TOMCAT_ROOT/logs) to make sure none of the log files have any stack traces
  • Look at the tomcat startup script to make check the location of the log files to see if the logs are not being written to another directory.
  • Another reason could be some other user/process could be issuing a kill -9 that could kill tomcat without giving it any chance to log errors.
2009-06-16 20:31
by neesh
The logs are at "debug" and are logging stuff, but not when tomcat stops - NoName 2009-06-16 20:45
that is a strong indication that something below tomcat is causing this failure - it could be something really bad in the JVM or an external entity just killing the jvm using a kill -9 like signa - neesh 2009-06-16 21:03
isn't kill a linux/unix command? Anyway, I get what you mean, but that's still weird : - NoName 2009-06-16 21:21
kill is a linux/unix command. The windows equivalent of this would be to kill the java process from the task manage - neesh 2009-06-16 21:27


1

Faced this issue recently.

Scenario : Tomcat started successfully but automatically gets shut down after 1 hour and sometimes this happened after 1 day and nothing is there in tomcat logs.

Issue : Actual issue was high memory usage and no free SWAP memory.

How I found the solution

If tomcat don't show any logs, then there must be something in system logs so, I checked /var/log/messages but since permission denied for me I tried /var/log/dmesg and got this

"Out of memory: Kill process 14606 (java) score 106 or sacrifice child".

In the output I noticed Swap Memory free 0 K. Ran top command to confirm the same. So, somehow there was a high memory usage which caused the OS to kill my tomcat process.

After spending hours finally got the reason.

ps -ef | grep tomcat showed that there were several tomcat processes running for the same application. It seems that, earlier tomcat shutdowns might not have taken successfully and the processes were not killed even after the shutdown due to some reason, which was causing the high memory usage.

So, killed all running tomcat processes using kill. SWAP memory got freed.

Started tomcat again, worked fine. :)

2018-09-19 08:07
by Kaushal Dokania
Thanks, this shows me a critical point. There is no enough memory and CPU resource at JVM for my both two applications which using java - ÖMER TAŞCI 2018-12-10 12:10


0

another possibility is that some process was started this morning on the box that is binding to a port that your server requires.

2009-06-16 20:37
by akf
I think he does say that the app runs normally for a few mins before tomcat dies. It wouldn't come up at all if the port is in use - neesh 2009-06-16 20:38
i agree this is an outlier. those elusive logs would be great, wouldnt they - akf 2009-06-16 20:40
If there was a "magic application" that was "stealing" the port, we would not be able to restart tomcat after it stops, but we can - NoName 2009-06-16 20:45


0

Are your servlets or one of it's dependencies allowed to call System.exit()? (Not sure how locked down Tomcat VMs are in that sense)

I've had developers thinking it's ok to use exit(666); on detecting a non-invertable matrix (which isn't good, but sure as heck not fatal). Arrgh. Perhaps you have some similar culprit in your system?

2009-06-16 21:25
by Macke
It's very unlikely because it worked for weeks before it happened and now it stops each 5 minutes... weird :| But we made test with the datas and war on another server and it seems OK. It looks like a configuration problem somewhere - NoName 2009-06-16 21:34


0

I noticed CATALINA_OPTS in my path and that was set for a lower JVM size. Hence, the crash and no log trace of tomcat was found. The server automatically shutdown in less than 2 hrs.

check, CATALINA_OPTS or JAVA_OPTS -- these might have jvm settings. either increase them or comment them out and increase the swap memory.

2015-01-26 22:16
by connect2krish


0

“The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs.”

I gone through the problem i have tried so many ways to get out of the problem finally i got the solution as follows.

1) Click Run Command from start button.

2) Enter Services.msc then click OK,you will get all the services in your computer.

3) Select your service and right click on the service and select Properties

4) Goto Logon Properties and select Local System Account then click OK.

This will work.

2015-07-20 06:59
by Niresh S


0

Sometime it happens if some other program is running on the same port. For example Skype. Shut down that program before you start Tomcat.

2018-04-27 15:23
by Harpreet Saini
Ads