Dave's Brain

Browse - Programming Tips - Why is Jetty giving NoClassDefFoundError exception on some pages

Date: 2015jul13
Product: Jetty
OS: Linux

Q.  Why is Jetty giving NoClassDefFoundError exception on some pages
after my webapp has run for a while?

A.  As you have probably read by now this error occurs when a
class that existed at compile time can not be found at run time.
Jetty unzips your .class files from your .war into /tmp/jetty*
For me the problem was that tmpwatch would delete rarely used .class
files from there after a while!

The solution is easy once you know the problem.

If you have /etc/tmpfiles.d ...

	Create /etc/tmpfiles.d/jetty and add:
		x /tmp/jetty*
		x /tmp/hsperfdata_*

If you have /etc/cron.daily/tmpwatch.conf ...

	Add -X /tmp/jetty*
	(Notice that is an uppercase -X)

Or change your Jetty configuration to unzip in a diffrent folder.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.