Tomcat shuts down automatically

后端 未结 10 1003
囚心锁ツ
囚心锁ツ 2020-12-14 09:43

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 T

10条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 10:07

    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

提交回复
热议问题