facebook

JSF Problems

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #248173 Reply

    zambizzi
    Member

    I just upgraded to 4.1.1 on Windows XP and I’m having problems w/ JSF.

    I created an EAR project which has a web project, an EJB, and the EAR project itself…which I’m deploying to JBoss 4.0.

    In the web project I added JSF capabilities using the Sun implementation. I then created a basic JSP JSF page called ‘index.jsp” in the web root folder (default page).

    Here’s the contents:

    
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
        <title>My JSF 'index.jsp' starting page</title>
    </head>
    <body>
        <f:view>
            This is my JSF JSP page. <br>
        </f:view>
    </body>
    </html>
    

    Here’s the exception JBoss is giving me:

    
    exception
    
    org.apache.jasper.JasperException
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
        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)
        com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
        com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
        com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
        com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
        com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
        org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    
    root cause
    
    java.lang.NullPointerException
        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.index_jsp._jspx_meth_f_view_0(org.apache.jsp.index_jsp:87)
        org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:62)
        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)
        com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
        com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
        com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
        com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
        com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
        org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    

    I’m not familiar w/ JSF (yet) but obviously it didn’t go off w/o a hitch. The faces servlet is defined in web.xml (automatically) like so:

    
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
      </servlet-mapping>
    

    All of the necessary jars and tld files are in my project…so I’m unsure what the problem is.

    Did I forget something?

    Thanks!

    #248179 Reply

    Greg
    Member

    Are you using index.jsp or index.faces when you load this page in the browser?

    #248193 Reply

    zambizzi
    Member

    I tried both, first tried index.faces and when that didn’t work, index.jsp…both return the same error.

    #248242 Reply

    It ran fine on Tomcat:
    1. I created a new Web project keeping all the settings to their default (J2EE 1.4)
    2. I added the Sun JSF RI keeping all the defaults.
    3. Created the new index.jsp and c/p the contents of your JSP.

    Page was accessible at following URL: http://localhost:8080/userreport/index.faces

    I will d/l JBoss and check if it works with it.

    #248303 Reply

    zambizzi
    Member

    I hadn’t noticed this before…but this might help you find the problem…I’m getting this error in the console in eclipse as well:

    
    ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.
    

    I tried changing this line in web.xml for the FacesServlet:

    
    <load-on-startup>0</load-on-startup>
    

    To this…

    
    <load-on-startup>1</load-on-startup>
    

    …but it made no difference, same exact errors. Tomcat 5.5.12 is the servlet container underneath JBoss 4.0.4 so I’m not sure why that would make any difference…but I suppose there could be something there.

    Either way, this has me at a complete stand-still, I can’t move forward on my already very short deadline…is there a work-around? Anything I can do?

    Thanks!

    #248360 Reply

    Don Nelson
    Member

    I have found that this is typically a problem with the URL – are you sure you are accessing your page as <WEB-ROOT>/index.faces?

    #248380 Reply

    JBoss bundles MyFaces with their distribution. To have it working with the JSF RI or latest MyFaces distro you need to remove the one bundled. It’s usually at jbossweb-tomcat55.sar/jsf-lib.

    #248382 Reply

    zambizzi
    Member

    Yes, you’re right, however when I followed the instructions and did that…it still wouldn’t work correctly. The only way I could get a JSF page to work was by switching the references to the taglibs to the tld files in my WEB-INF folder. Other JBoss users are having the same issues.

    I gave up on JSF anyhow, I can’t force myself to like it no matter how hard I try. I went w/ Wicket so I could get the job done.

    Thanks!

    #248384 Reply

    Right, I changed the TLD URIs too – but forgot to mention that because did it a couple hours before I found out aboth the bundled MyFaces.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: JSF Problems

You must be logged in to post in the forum log in