Over a million developers have joined DZone.

Using JSF 2 with Google App Engine

DZone's Guide to

Using JSF 2 with Google App Engine

· Java Zone
Free Resource

Managing a MongoDB deployment? Take a load off and live migrate to MongoDB Atlas, the official automated service, with little to no downtime.

Since last week I have been playing with Google App Engine (GAE) and some of the frameworks that we normally use in enterprise applications. After developing some basic servlets to get comfortable with appspot I decided to use JSF 2. I wanted to see how well it fits in GAE aware of the fact that there are quite a few caveats mentioned on GAE website regarding JSF. I followed the obvious steps mentioned on the help pages but I think they are a bit outdated.

I decided to compile a list that one can follow to successfully get JSF 2.0.1 (Mojarra) working on GAE 1.2.6. If you have followed steps provided elsewhere and are still getting the following errors beware that you might have missed one or more of the setting provided.


  1. Will it play in GAE - Gives of list of technologies which are supported on GAE
  2. Configuring JSF 2 in GAE - Configuration provided by Google but this doesn't work straightaway
  3. JSF 2 Compatibility Issues - Compatibility issues with JSF 2
  4. JSF 2 impl jar fix - Josh has kindly provided a fix for JSF impl jar which resolves the startup problem

Setup steps:

  • Follow the steps provided in the jsf configuration guide on GAE website (see Resources:2)
  • Replace the jsf-impl.jar with provided on Josh's blog page . Stack trace fixed


WARNING: Error starting handlers Throwable occurred:


  • Now you app should start up on dev box but it when you deploy it on GAE you will get the following stack trace (lower the level to debug or warning)


Nested in javax.servlet.ServletException: java.lang.RuntimeException: java.lang.ClassNotFoundException: void:
java.lang.RuntimeException: java.lang.ClassNotFoundException: void
 at com.google.apphosting.runtime.jetty.SessionManager.deserialize(SessionManager.java:389)
 at com.google.apphosting.runtime.jetty.SessionManager.loadSession(SessionManager.java:307)
 at com.google.apphosting.runtime.jetty.SessionManager.getSession(SessionManager.java:282)
 at org.mortbay.jetty.servlet.AbstractSessionManager.getHttpSession(AbstractSessionManager.java:237)
 at org.mortbay.jetty.Request.getSession(Request.java:998)
 at com.sun.faces.application.WebappLifecycleListener.syncSessionScopedBeans(WebappLifecycleListener.java:393)


  • In order to fix the above exception make sure following configuration are in web.xml (These are recommendations from GAE JSF2 compatibility issues: see Resources:3)


<!-- Seems like GAE 1.2.6 cannot handle server side session management. At least for JSF 2.0.1 -->
<!-- Recommendation from GAE pages  -->


  • Finally, I have noticed that sometimes objects kept in session loose data. For instance, I created a session scoped managed bean called CustomerBean and added customer name and email to it. When I move to second view, the name and email address stored in the managed bean are lost. Now this happens only on appspot not on the dev server so I can't debug and I haven't yet figured out why it this happens. I am working on a strange hack which put a token key value in the session in every request which solves the issue but I am sure why.
    If anyone has any clue why please post a comment.

Hopefully, these setting will get you started on your first JSF 2 app on Google App Engine.

MongoDB Atlas is the easiest way to run the fastest-growing database for modern applications — no installation, setup, or configuration required. Easily live migrate an existing workload or start with 512MB of storage for free.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}