This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
1. create a web project with JSF framework support 2. run it and wait until index.jsp is shown in a browser 3. click at the link "Java Server Faces Welcome Page" Error page is shown - see attachment. NB060102, JBoss4.0.3SP1, JDK1.5.0_02, JSF1.1 libraries (bundled in the WAR files by NetBeans)
Created attachment 28154 [details] Error page content
Fixable in 5.1
In NB IDE File=>New Project In New Project dialog Web=>Web Application Next> Project Name (AllJSPJSF) Source Structure: Java BluePrints Server: Bundled Tomcat (5.5.9) Context Path: /AllJSPJSF X Set Source Level to 1.4 Set as Main Project (unset) Next> X Java Server Faces Struts 1.2.7 (unset) Next> Servlet URL Mapping: /faces/* X Validate XML Verify Objects (unset) Finish The file AllJSPStruts/web/WEB-INF/web.xml will not validate. There are two XML nodes for the servlet "Faces Servlet". <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
There were more duplicate entries in web.xml. <servlet-mapping> was duplicated. The <context-param> nodes for com.sun.faces.verifyObjects, com.sun.faces.validateXml, javax.faces.CONFIG_FILES, and javax.faces.STATE_SAVING_METHOD were triplicated. Fixing these errors, I managed to generate an application that was deployable in Tomcat. Then, I got the error that is in this bug report. The log contains the entry Jun 2, 2006 6:14:35 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet jsp threw exception javax.servlet.jsp.JspException: Cannot find FacesContext at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:405) faces-config.xml is still empty and this may not be legitimate. <faces-config> </faces-config>
Regenerated the JSF. No duplicates seen, so ignore the comments in my previous post. The web.xml looks valid. But it is not. The generated code is wrong in two places. The fix for this bug involves changes to both index.jsp and web.xml. In index.jsp, the anchor <a href="./faces/welcomeJSF.jsp">Java Server Faces Welcome Page</a> should read <a href="/WebApp/welcomeJSF.faces">Java Server Faces Welcome Page</a> In web.xml, the servlet mapping for "Faces Servlet" is <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>faces/*</url-pattern> </servlet-mapping> and should be <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping>
The servlet mapping is correct. welcomeJSF.jsp is referenced from the index.jsp as /faces/welcomeJSF, thus /faces/* pattern is recognized and the Faces Servlet is used. Of course '*.faces' way of mapping works also well. There are two ways how to solve the exception. 1/ remove jbossweb-tomcat55.sar/jsf-libs directory, i.e. the server does not use MyFaces, instead of it JSF libraries bundled with the Web module are used 2/ IDE mustn't package the JSF and JSTL libraries into the Web module and <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> must be added into the web.xml. The second way will be used to fix this bug. Reassining to 'JSF' module.
*** Issue 76733 has been marked as a duplicate of this issue. ***
*** Issue 74392 has been marked as a duplicate of this issue. ***
Already fixed.