1 Reply Latest reply on Apr 5, 2007 2:28 PM by Russ

    MyFaces and JBoss is not playing nice!

    Russ Newbie

      Good Morning All:

      I am hoping someone can clarify what is the correct steps for getting a MyFaces Web Project up and running using JBoss 4.0.5 within MyEclipse 5.1.1. I have tried to follow the steps outlined in JBoss http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces, but I am not very successful.


      When I follow JBoss instructions by removing the jsf-lib and using the MyEclipse jar files from the web/lib for MyFaces 1.1.1, I get the following error:

      07:58:38,609 DEBUG [TagLibCache] Scanning for tlds in: file:/C:/jboss-4.0.5.GA/server/default/deploy/jbossweb-tomcat55.sar/jsf-libs/myfaces-impl.jar
      07:58:38,609 DEBUG [TagLibCache] Failed to scan: jsf-libs/myfaces-impl.jar
      java.io.FileNotFoundException: C:\jboss-4.0.5.GA\server\default\deploy\jbossweb-tomcat55.sar\jsf-libs\myfaces-impl.jar
      



      When I leave the libraries for JBoss in place and use the MyEclipse libraries within the web/lib for the project, I get the following error:

      08:05:24,828 ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.
      08:05:24,859 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException
       at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615)
       at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217)
       at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71)
       at org.apache.jsp.main_jsp._jspx_meth_f_view_0(main_jsp.java:88)
       at org.apache.jsp.main_jsp._jspService(main_jsp.java:64)
      


      What I have done is create a simple Java Server Faces project using MyEclipse whereby I created a web project and added JSF capability MyFaces1.1.1). Next I created some JSPs and markups for the frontend portion of this example. What I am trying to accompllish is move around the different JSPs to ensure everything is working properly before I get complicated.

      When I type in the URL to the Parent (index.html), I get the markup to display. When I click on the link, what is suppose to happen is the screen moves to the index.jsp. The index.jsp has nothing more than a forward to the main.jsp. In the main.jsp is where all the Java Server Faces markup is located. However, I am getting a 500 HTTP status. What appears to me is the server is not able to find the tag libaries for the project as the error stops on the <f:view> line within the main.jsp. This is the error:


      org.apache.jasper.JasperException: Exception in JSP: /index.jsp:7
      
      4: <title>A Simple JavaServer Faces Registration Application</title>
      5: </head>
      6: <body>
      7: <jsp:forward page="/main.jsp" />
      8: </body>
      9: </html>
      
      
      Stacktrace:
       org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
       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)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      
      root cause
      
      org.apache.jasper.JasperException: Exception in JSP: /main.jsp:5
      
      2: <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      3: <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      4:
      5: <f:view>
      6: <html>
      7: <head>
      8: <title>A Simple JavaServer Faces Registration Application</title>
      


      As this is a learning situation for me, I was hoping others could provided some clarification. Is there something special I need to accomplish for JBoss that has not been documented?

      Any suggestions would be greatly appreciated as I've been working through this error going on 24 hrs. This error needs to die quickly.... :-)

      Russ

        • 1. Re: MyFaces and JBoss is not playing nice!
          Russ Newbie

          Okay! We are working :-)

          What I had to do was change the foward from:

          <jsp:forward page="/main.jsp" />
          


          to:

          <jsp:forward page="/faces/main.jsp" />
          


          and everything worked and matched the web.xml

          <servlet-mapping>
           <servlet-name>Faces Servlet</servlet-name>
           <url-pattern>/faces/*</url-pattern>
           </servlet-mapping>
          



          Russ