Classes missing if application runs for a long time
Posted
by
Rogach
on Stack Overflow
See other posts from Stack Overflow
or by Rogach
Published on 2012-09-13T03:39:06Z
Indexed on
2012/09/16
3:38 UTC
Read the original article
Hit count: 351
I have a funny problem - if my application runs for a long time (> 20h), then sometimes I get NoClassDefFound error - seems like JVM decided that the class is not going to be used anyway and GCd it.
To be a bit more specific, here's an example case:
object ErrorHandler extends PartialFunction[Throwable,Unit] {
def isDefinedAt(t: Throwable) = true
def apply(e: Throwable) =e match {
// ... handle errors
}
}
// somewhere else in the code...
try {
// ... long running code, can take more than 20 hours to complete
} catch (ErrorHandler)
And I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/rogach/avalanche/ErrorHandler$
If that try/catch block runs for smaller amounts of time, everything works as expected.
If anyone is interested, here is the codebase in question: Avalanche
I need to note that I saw this and similar problems only on Cent OS 5
machines, using JRE 6u26 and Scala 2.9.1 / 2.9.2.
What could be the cause of this problem?
© Stack Overflow or respective owner