JSF on Tomcat 6

I tried my hands on JSF last Friday. It didn’t go as smoothly as I expected.

Being the bleeding edge kind of person :P I set it up using Tomcat 6 and a quick start package from Exadel. The package already has all the jar files you need and you only need to type in (or  cut-and-paste) some missing java code and jsp scripts. That done, I tried accessing /jskfs/pages. It didn’t work so I tried accessing directly inputname.jsp:

java.lang.NullPointerException
com.sun.faces.taglib.jsf_core.LoadBundleTag.doStartTag(LoadBundleTag.java:96)

I figured, hey maybe I should try the latest reference implementation. That would also be in keeping up with being a bleeding edge kind of person :P So I went to Sun and downloaded latest  reference implementation mojarra-1.2_09-b02-FCS-binary.zip, installed it to /jskfs/WEB-INF/lib, and again tried accessing inputname.jsp:

javax.servlet.ServletException: java.lang.NoSuchMethodError: com.sun.faces.taglib.jsf_core.LoadBundleTag.setBasename(Ljava/lang/String;)

It got worse. Figuring that the reference implementation is incomplete (don’t ask why). So I went to Apache.org and downloaded MyFaces, their implementation of JSF: myfaces-core-1.2.4-bin.zip. I installed it and tried again:

SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener

I took a look at the web.xml file, found, and commented this out:

<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

I tried again:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/sun/faces/taglib/jsf_core/LoadBundleTag

I read somewhere that flushing the web app’s files in the work directory sometimes works so I did and then tried again:

javax.servlet.jsp.JspException: No faces context?!
org.apache.myfaces.taglib.core.LoadBundleTag.doStartTag(LoadBundleTag.java:77)

I tried accessing via the entry point /jskfs/pages. It finally worked.

On a hunch, I went full circle and restored the original jar files, cleared the work directory, and tried accessing via the entry point again. Guess what? It worked 8-}

Comments are closed.