Tuesday, October 6, 2009

CentOS5: Kernel 2.6.18-164.el5 causes panic

The kernel 2.6.18-164 causes serious ext3 filesystem problems (ext3_free_blocks_sb). We lost data in the / partition.
Downgrading to -128.7.1 helped working that serious problem around.

To prevent this kernel to be installed, add the following lines to /etc/yum.conf:

# We know this kernel causes a crash
exclude=kernel-2.6.18-164.el5 kernel-headers-2.6.18-164.el5

Afterwards, you can perform a "yum update" as usual.
More info:
http://bugs.centos.org/view.php?id=3846
https://bugzilla.redhat.com/show_bug.cgi?id=494927
http://forum.r1soft.com/showthread.php?t=1158

Thursday, April 9, 2009

NoClassDefFoundError in JSP for Class with static block on tomcat restart (spuriously)

The other day I had a strange problem with a Spring/JSF application.
Every now and then when I restarted tomcat, my application has thrown a NoClassDefFoundError in a JSP.
The reason for this is quite complex.
The JSP tried to execute a static method of a session bean.
In this session bean, I had a static block which was loaded from a Spring bean class.

As the session gets restored some times before the ApplicationContext was created during startup, this leaded to a NullPointer exception. (This was seen in the tomcat log, but you will notice it later in the jsp).

Example:

public class MySessionClass implements Serializable {
// the static block which causes the problem later during session restore
// as the SpringBeanClass is not available during session restore in tomcat startup.
public final static String myStaticField = SpringBeanClass.staticMethod();

public static void myMethod(){...}
}


Solution:
I resolved it in the getter Method of the field, where I initialize the field if not set and therefore, I get rid of the static field.