Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 70952 - A web project created with a JSF support fails to run the Faces Servlet
A web project created with a JSF support fails to run the Faces Servlet
Status: RESOLVED FIXED
Product: javaee
Classification: Unclassified
Component: JSF
5.x
All All
: P3 (vote)
: 5.x
Assigned To: Petr Pisl
issues@javaee
fix-in-55
:
: 74392 76733 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-03 16:20 UTC by Libor Kotouc
Modified: 2006-08-09 09:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
Error page content (2.43 KB, text/plain)
2006-01-03 16:23 UTC, Libor Kotouc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Libor Kotouc 2006-01-03 16:20:53 UTC
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)
Comment 1 Libor Kotouc 2006-01-03 16:23:44 UTC
Created attachment 28154 [details]
Error page content
Comment 2 Libor Kotouc 2006-01-06 13:21:32 UTC
Fixable in 5.1
Comment 3 ajacobs3 2006-06-02 18:41:48 UTC
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>
Comment 4 ajacobs3 2006-06-03 02:31:36 UTC
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>

Comment 5 ajacobs3 2006-06-07 06:59:43 UTC
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>
Comment 6 Libor Kotouc 2006-06-07 13:02:00 UTC
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.
Comment 7 Libor Kotouc 2006-06-07 15:39:16 UTC
*** Issue 76733 has been marked as a duplicate of this issue. ***
Comment 8 Libor Kotouc 2006-06-07 15:40:03 UTC
*** Issue 74392 has been marked as a duplicate of this issue. ***
Comment 9 Petr Pisl 2006-08-09 09:56:58 UTC
Already fixed. 


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo