Thoughts on systems, software, and what actually matters.
JavaEE – Clustering support in JSF, Wicket, ZK, etc.

JavaEE – Clustering support in JSF, Wicket, ZK, etc.

When a seasoned MVC framework developer starts writing code in component based framework like JSF, Wicket, ZK, etc. they fail to understand the basic differences between MVC and component based framework because they could write code which can work in non-clustered environment i.e. in single JVM deployment. When the same application is deployed in clustered environment, it starts failing.

The key difference is that component-based frameworks store component state in the HttpSession, while MVC frameworks are typically stateless. This means:

  • All objects stored in session must be Serializable
  • Component trees must be properly serialized and deserialized
  • Session affinity (sticky sessions) can help but isn't a complete solution

To make your component-based framework application cluster-ready:

  1. Ensure all session-scoped beans implement Serializable
  2. Avoid storing non-serializable objects in session
  3. Use session replication or shared session storage
  4. Test in a clustered environment during development