4 Replies Latest reply on Apr 10, 2007 6:53 AM by pkraemer

    JBoss 4.0.5 and JSF Faces context not found

    pkraemer

      Hello,

      first let me say, I have red the wiki page about how to use JSF with JBoss.

      I use:

      JBoss 4.0.5
      MyFaces Tomahawk
      EJB 3.0

      I've deployed the application as an *.ear file including the ejb.jar and web.war file. There are no JSF libs within /WEB-INF/lib.

      When I start JBoss the ear file is deployed with
      out any error, but when I try to start the webapplication I get the error:
      [STDOUT] 10:32:57,814 ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.



      This is a part of the application structure:


       +TestEJB
       +serverEJB
       - TestBean
       - TestRemote
       +META-INF
       - ejb-jar.xml
       +TestWeb
       +clientSrc
       - TestMBean
       +web
       +WEB-INF
       - web.xml
       - faces-config.xml
       -index.jsp
      


      And this is a part of the web.xml File:

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
       version="2.4">
      
       <context-param>
       <param-name>javax.faces.CONFIG_FILES</param-name>
       <param-value>/WEB-INF/faces-config.xml</param-value>
       </context-param>
      
       <filter>
       <filter-name>extensionsFilter</filter-name>
       <filter-class>
       org.apache.myfaces.webapp.filter.ExtensionsFilter
       </filter-class>
       <init-param>
       <param-name>uploadMaxFileSize</param-name>
       <param-value>100m</param-value>
       </init-param>
       <init-param>
       <param-name>uploadThresholdSize</param-name>
       <param-value>100k</param-value>
       </init-param>
      
      
       </filter>
      
       <filter-mapping>
       <filter-name>extensionsFilter</filter-name>
       <url-pattern>*.jsf</url-pattern>
       </filter-mapping>
      
       <filter-mapping>
       <filter-name>extensionsFilter</filter-name>
       <url-pattern>/faces/*</url-pattern>
       </filter-mapping>
      
      
       <servlet>
       <servlet-name>faces</servlet-name>
       <servlet-class>
       javax.faces.webapp.FacesServlet
       </servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>faces</servlet-name>
       <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
      
      <listener>
       <listener-class>
       org.apache.myfaces.webapp.StartupServletContextListener
       </listener-class>
      </listener>
      </web-app>
      
      



      Please, can any one help me. Did I forget something to add?

      Thx

        • 1. Re: JBoss 4.0.5 and JSF Faces context not found
          gcoleman

          What URL are you requesting? index.jsp or index.jsf?

          • 2. Re: JBoss 4.0.5 and JSF Faces context not found
            pkraemer

            I am requestion *.jsf

            • 3. Re: JBoss 4.0.5 and JSF Faces context not found
              pkraemer

              Hey,

              I tried it again with JBoss Wiki and O'Reilly's JSFExamples and it works fine.

              Then I try to run my one application, added the same librarys which are in JSFExamples and used simple MyFaces components.

              Now when I add the extension filter I get an error:


              1:45:50,602 ERROR [ContextConfig] Parse error in application web.xml file at jndi:/localhost/ConverterWeb/WEB-INF/web.xml
              java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name extensionsFilter
              at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2725)
              at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2751)
              at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1060)
              at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)


              during deployment process.

              If I delete the extension Filter project is deployed corret, but when I call the project I get the error:



              [STDOUT] 10:32:57,814 ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.


              That's my web.xml:

              <?xml version="1.0" encoding="ISO-8859-1"?>
              
              <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
               http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
               version="2.4">
              
               <context-param>
               <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
               <param-value>client</param-value>
               </context-param>
              
               <!-- Faces Servlet -->
               <servlet>
               <servlet-name>FacesServlet</servlet-name>
               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
               <load-on-startup>1</load-on-startup>
               </servlet>
              
               <servlet-mapping>
               <servlet-name>FacesServlet</servlet-name>
               <url-pattern>*.faces</url-pattern>
               </servlet-mapping>
              
               <filter-mapping>
               <filter-name>extensionsFilter</filter-name>
               <url-pattern>*.jsf</url-pattern>
               </filter-mapping>
              
               <filter-mapping>
               <filter-name>extensionsFilter</filter-name>
               <url-pattern>/faces/*</url-pattern>
               </filter-mapping>
              
               <listener>
               <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
               </listener>
              
               <ejb-ref>
               <ejb-ref-name>ejb/ConverterRemote</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <home>java.lang.Object</home>
               <remote>converter.ConverterRemote</remote>
               </ejb-ref>
              
              </web-app>
              


              and my simple index.jsp

              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
              <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="x"%>
              <f:view>
              
              <x:document>
               <x:documentHead>
              
               </x:documentHead>
               <h:outputText value="Hallo"/>
               <x:documentBody>
              
               </x:documentBody>
              </x:document>
              </f:view>
              


              I need your help please

              Thx

              • 4. Re: JBoss 4.0.5 and JSF Faces context not found
                pkraemer

                Now I have added the common-file-upload.jar to JBoss lib.

                When I start the application with:
                http://localhost:8080/ConverterWeb/

                I get:


                org.apache.jasper.JasperException: Exception in JSP: /index.jsp:5

                2: <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                3: <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="x"%>
                4: <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                5: <f:view>
                6:
                7: <x:document>
                8: <x:documentHead>


                Stacktrace:
                org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
                org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
                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.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
                org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

                root cause

                java.lang.NullPointerException
                javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:929)
                javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:310)
                org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:70)
                org.apache.jsp.index_jsp._jspx_meth_f_view_0(index_jsp.java:90)
                org.apache.jsp.index_jsp._jspService(index_jsp.java:68)
                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:334)
                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.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
                org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


                Where are my mistakes? I am confused