Unwrapping JSF java.lang.IllegalArgumentException: null source

Posted by Roger Keays, 21 June 2011, 3:15 PM

Here's a great mysterious JSF error using Mojarra 2.0.2:

java.lang.IllegalArgumentException: null source
	at java.util.EventObject.<init>(EventObject.java:38)
	at javax.faces.event.SystemEvent.<init>(SystemEvent.java:71)
	at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:73)
	at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:73)
	at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:265)
	at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:251)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:111)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at au.com.ninthavenue.webcore.webapp.WebcoreFilter.doFilter(WebcoreFilter.java:452);

The problem is JSF is swallowing the real error as described at http://java.net/jira/browse/JAVASERVERFACES-1758. Fortunately, it has been fixed in JSF 2.1, but unfortunately JSF 2.1 doesn't run on Tomcat.

So, what to do?

Well, there is a novel solution.

  1. Downgrade to JSF 2.0.2
  2. Check the exception.
  3. Fix the problem.
  4. Upgrade back to JSF 2.0.3

Worked for me, but a freaking lot of work to find a typo in my template.

Add a comment

Please visit http://www.ninthavenue.com.au/unwrapping-jsf-java-lang-illegalargumentexception-null-source to add your comments.