Search code examples
javatomcatjava-melody

Tomcat JavaMelody strange error ThreadDeath


Java Melody is generating a error running on Tomcat and I have no idea how to solve it.

java.lang.ThreadDeath
  at java.lang.Thread.stop(Thread.java:836)
  at net.bull.javamelody.Action.stopThread(Action.java:388)
  at net.bull.javamelody.Action.killThread(Action.java:374)
  at net.bull.javamelody.Action.execute(Action.java:227)

This error is being throw 18 times.

What can I do? There is not much information about it on the web.

We know it because we have a error logger in a MySQL table and there is 18 records on it with this error.

There is a chance is the click on the console button the error would be throw to a particular user. I mean, if I click abort button in a console or so the user will see any error?


Solution

  • This error is caused when you use the deprecated stop() method to kill a thread. The stack trace indicates that someone did click on the kill thread button.

    net.bull.javamelody.Action.killThread(Action.java:374)
    

    ThreadDeath is an Error that you cannot recover from. I'd recommend using BASIC authentication on your monitoring URLs and ensuring that threads are not killed. stop() has been deprecated and killing individual threads in the application is never recommended under any circumstance.