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.
Summary: | A web project created with a JSF support fails to run the Faces Servlet | ||
---|---|---|---|
Product: | javaee | Reporter: | Libor Kotouc <lkotouc> |
Component: | JSF | Assignee: | Petr Pisl <ppisl> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | bleonard |
Priority: | P3 | ||
Version: | 5.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Error page content |
Description
Libor Kotouc
2006-01-03 16:20:53 UTC
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. |