Upgrading from JSF 1.0.x to 1.1 at customer site
I wanted to share a small case resolution I had to resolve at customer site, I think the main conclusion from the issue was before starting to troubleshooting, read carefully your exception stack trace. </meta>
Case details at glance
- Customer had two myfaces web applications deployed under JBoss 4.0.5 with in a ear.
- The customer wanted to upgrade one of the web application from old myfaces 1.0.x version to 1.1.x
- The customer wanted to from JDK5 to JDK6.
- The upgrade from myfaces 1.0.x to 1.1.x was successful under JDK5 </meta>
- Under JDK6 after using the login method, an error page with following exception was displayed:
ERROR [UIComponentTag] Faces context not found. javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615) javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217) org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71) org.apache.jsp.pages.Home_jsp._jspService(org.apache.jsp.pages.Home_jsp:98) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Case resolution options
The above exception imply a JSF initialization error , several causes might be
- Duplication of JSF jars which result classloading issue
- JSF Misconfiguration
Most of the recommendation after googling about the issue is to find JSF duplication jars, or examine the web.xml <servlet-mapping> misconfiguration
My first step was to examine the jars duplication and found out I have 3 JSF's jars, 1 under jbossweb-tomcat.sar , and 2 under each war file.
removing the jsf-lib jars under jbossweb-tomcat.sar, a necessary step to eliminate jsf's issues, but the step didn't helped me to resolve the exception.
My second step was to examine the web.xml and try to figure out misconfiguration, the FacesServlet <servlet-mapping> configuration was OK, it was mapping *.jsf request correctly.
That's left me with no other options, I started to look back into the Exception details, and found out the request wasn't handled by the FacesServlet, which explain for sure, why FacesContext is not initialized.
I went back to the web.xml and examined it carefully, and found the issue, a unkown to me,
servlet was configured to catch all request.
<!-- definition for the default servlet --> <servlet> <servlet-name>DefaultServletOverride</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>listings</param-name> <param-value>false</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- Add a mapping for our new default servlet --> <servlet-mapping> <servlet-name>DefaultServletOverride</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
Removing the above configuration, resolved the issue.
I think the main lesson I learned, as always, don't hurry to google around using the info you collected at first insight, take a deep breath and read the exception details carefully.
We will contact you as soon as possible.