8 Replies Latest reply on Aug 28, 2009 9:45 AM by jblas

    Problem with 3.2.2.GA and simple echo

    newman

      Hello. All I have in my app at the moment is the simple echo example from the documentation. I'm using MyFaces 1.2.4, no Tomahawk. I can't even get to the first page of the app which doesn't have any ajax or richfaces at all and instead it gives me this error -

      HTTP Status 500 -

      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      org.apache.jasper.JasperException: java.lang.NullPointerException
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

      root cause

      java.lang.NullPointerException
      java.lang.String.startsWith(String.java:1252)
      java.lang.String.startsWith(String.java:1281)
      org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:189)
      org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:222)
      org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:139)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500)
      org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:696)
      org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:667)
      org.apache.jsp.index_jsp._jspService(index_jsp.java:54)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

      note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
      Apache Tomcat/6.0.18


      When I go back to RichFaces 3.2.1.GA it works. I've googled quite a lot to no avail.

      Thanks in advance for any help.



        • 1. Re: Problem with 3.2.2.GA and simple echo
          nbelaevski

          Hello,

          Please post web.xml contents. Thank you in advance!

          • 2. Re: Problem with 3.2.2.GA and simple echo
            newman

            <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://java.sun.com/xml/ns/javaee"
            xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
            xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
            id="WebApp_ID" version="2.5">

            <display-name>Someapp</display-name>
            <!-- -->

            <display-name>RichFaces Filter</display-name>
            <filter-name>richfaces</filter-name>
            <filter-class>org.ajax4jsf.Filter</filter-class>


            <filter-mapping>
            <filter-name>richfaces</filter-name>
            <servlet-name>Faces Servlet</servlet-name>
            REQUEST
            FORWARD
            INCLUDE
            </filter-mapping>
            <login-config>
            <auth-method>BASIC</auth-method>
            </login-config>


            <context-param>
            <param-name>org.richfaces.SKIN</param-name>
            <param-value>blueSky</param-value>
            </context-param>

            <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>server</param-value>
            </context-param>





            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>


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

            <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
            classpath:someapp-services.xml
            classpath:someapp-data.xml
            classpath:someapp-faces-beans.xml
            </param-value>
            </context-param>


            <listener-class>
            org.springframework.web.context.ContextLoaderListener
            </listener-class>


            <!-- This is for Spring-JSF integration -->

            <listener-class>
            org.springframework.web.context.request.RequestContextListener
            </listener-class>

            <!--

            <filter-name>sessionFilter</filter-name>
            <filter-class>
            rg.springframework.orm.hibernate3.support.OpenSessionInViewFilter
            </filter-class>



            <filter-mapping>
            <filter-name>sessionFilter</filter-name>
            <url-pattern>/faces/*</url-pattern>
            <url-pattern>*.jsf</url-pattern>
            </filter-mapping>
            -->






            <!--<context-param>

            If true, rendered HTML code will be formatted, so that it is
            "human readable". i.e. additional line separators and
            whitespace will be written, that do not influence the HTML
            code. Default: "true"

            <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
            <param-value>true</param-value>
            </context-param>
            -->

            </web-app>

            There it is sorry about the formatting!

            • 3. Re: Problem with 3.2.2.GA and simple echo
              newman

              Sorry I'm now using JSF Mojarra as I wanted to not have STATE_SAVING_METHOD as client.

              Anyway I made a little test app without spring and a lot of other stuff and I get the same problem:

              pom.xml


              <project xmlns="http://maven.apache.org/POM/4.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
              4.0.0
              tutorial
              testrichfaces
              war
              1.0-SNAPSHOT
              testrichfaces


              junit
              junit
              3.8.1
              test


              javax.faces
              jsf-api
              1.2_09


              javax.faces
              jsf-impl
              1.2_09


              javax.servlet
              jstl
              1.2


              taglibs
              standard
              1.1.2

              <!-- Richfaces dependencies -->

              org.richfaces.framework
              richfaces-api
              3.2.2.GA


              org.richfaces.framework
              richfaces-impl
              3.2.2.GA


              org.richfaces.ui
              richfaces-ui
              3.2.2.GA



              testrichfaces


              maven-compiler-plugin

              1.5
              1.5



              org.apache.maven.plugins
              maven-eclipse-plugin
              2.5.1

              2.0


              org.springframework.ide.eclipse.core.springnature



              <jst.jsf>1.2</jst.jsf>
              <jst.web>2.5</jst.web>



              org.springframework.ide.eclipse.core.springbuilder


              true
              true






              maven-repository.dev.java.net
              Java Dev Net Repository
              http://download.java.net/maven/2/

              true
              never


              false



              jboss
              JBoss Repository
              http://repository.jboss.org/maven2




              web.xml

              <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
              id="WebApp_ID" version="2.5">


              <display-name>Archetype Created Web Application</display-name>
              <context-param>
              <param-name>org.richfaces.SKIN</param-name>
              <param-value>blueSky</param-value>
              </context-param>


              <display-name>RichFaces Filter</display-name>
              <filter-name>richfaces</filter-name>
              <filter-class>org.ajax4jsf.Filter</filter-class>


              <filter-mapping>
              <filter-name>richfaces</filter-name>
              <servlet-name>Faces Servlet</servlet-name>
              REQUEST
              FORWARD
              INCLUDE
              </filter-mapping>

              <context-param>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>server</param-value>
              </context-param>


              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>


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

              </web-app>

              faces-config.xml

              <?xml version="1.0" encoding="UTF-8"?>
              <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
              version="1.2">

              <managed-bean>
              <managed-bean-name>bean</managed-bean-name>
              <managed-bean-class>richfaces.demo.Bean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
              <property-name>text</property-name>

              </managed-property>
              </managed-bean>

              </faces-config>

              echo.jsp


              <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

              <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

              <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>





              repeater





              <f:view>

              <h:form>

              <rich:panel header="Simple Echo">

              <h:inputText size="50" value="#{bean.text}" >

              <a4j:support event="onkeyup" reRender="rep"/>

              </h:inputText>

              <h:outputText value="#{bean.text}" id="rep"/>

              </rich:panel>

              </h:form>

              </f:view>





              I access it at localhost:8080/testrichfaces/echo.jsf

              • 4. Re: Problem with 3.2.2.GA and simple echo
                nbelaevski

                Hello,

                <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>/faces/*</url-pattern>
                <url-pattern>*.jsf</url-pattern>
                </servlet-mapping>
                is invalid according to web application schema.

                Please use:
                <servlet-mapping>
                 <servlet-name>Faces Servlet</servlet-name>
                 <url-pattern>*.jsf</url-pattern>
                 </servlet-mapping>
                
                 <servlet-mapping>
                 <servlet-name>Faces Servlet</servlet-name>
                 <url-pattern>/faces/*</url-pattern>
                 </servlet-mapping>
                


                • 5. Re: Problem with 3.2.2.GA and simple echo
                  benoit.heinrich

                  Hi, I've just updated my richfaces version from 3.2.2.GA to 3.2.2.SR1, and I'm getting the same error.

                  I'm using seam 2.1.1.CR2 and richfaces 3.2.2.SR1.


                  Here is the content of my web.xml:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
                   <display-name>Vocado</display-name>
                  
                   <!-- Resources filter ${resources.filter} -->
                  
                  
                   <!-- GZip Filter -->
                   <filter>
                   <filter-name>GZipCompress</filter-name>
                   <filter-class>com.example.components.common.filter.GZIPFilter</filter-class>
                   </filter>
                   <filter-mapping>
                   <filter-name>GZipCompress</filter-name>
                   <url-pattern>*.AjaxScript</url-pattern>
                   <url-pattern>*.PrototypeScript</url-pattern>
                   <url-pattern>*.ImageCacheScript</url-pattern>
                   <url-pattern>*.html</url-pattern>
                   <url-pattern>*.xhtml</url-pattern>
                   <url-pattern>*.css</url-pattern>
                   <url-pattern>*.xcss</url-pattern>
                   <url-pattern>*.js</url-pattern>
                   <url-pattern>*.seam</url-pattern>
                   </filter-mapping>
                  
                  
                   <!-- Richfaces -->
                   <context-param>
                   <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                   <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                   </context-param>
                   <context-param>
                   <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
                   <param-value>false</param-value>
                   </context-param>
                   <context-param>
                   <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
                   <param-value>false</param-value>
                   </context-param>
                  
                   <!-- Seam -->
                   <listener>
                   <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                   </listener>
                   <servlet>
                   <servlet-name>Seam Resource Servlet</servlet-name>
                   <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
                   </servlet>
                   <servlet-mapping>
                   <servlet-name>Seam Resource Servlet</servlet-name>
                   <url-pattern>/seam/resource/*</url-pattern>
                   </servlet-mapping>
                   <filter>
                   <filter-name>Seam Filter</filter-name>
                   <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
                   <!-- File Upload Params -->
                   <init-param>
                   <param-name>createTempFiles</param-name>
                   <param-value>true</param-value>
                   </init-param>
                   <init-param>
                   <param-name>maxRequestSize</param-name>
                   <!-- 3 MB -->
                   <param-value>3145728</param-value>
                   </init-param>
                   </filter>
                   <filter-mapping>
                   <filter-name>Seam Filter</filter-name>
                   <url-pattern>/*</url-pattern>
                   </filter-mapping>
                  
                   <!-- JSF -->
                   <context-param>
                   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                   <param-value>.xhtml</param-value>
                   </context-param>
                   <context-param>
                   <param-name>facelets.DEVELOPMENT</param-name>
                   <param-value>${seam.debug}</param-value>
                   </context-param>
                  
                   <!-- Do not evaluate comments in xhtml pages -->
                   <context-param>
                   <param-name>facelets.SKIP_COMMENTS</param-name>
                   <param-value>true</param-value>
                   </context-param>
                   <servlet>
                   <servlet-name>Faces Servlet</servlet-name>
                   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                   </servlet>
                   <servlet-mapping>
                   <servlet-name>Faces Servlet</servlet-name>
                   <url-pattern>*.seam</url-pattern>
                   </servlet-mapping>
                  
                  
                   <session-config>
                   <session-timeout>10</session-timeout>
                   </session-config>
                   <context-param>
                   <param-name>facelets.LIBRARIES</param-name>
                   <param-value>/WEB-INF/facelets/example.taglib.xml;/WEB-INF/facelets/example_c.taglib.xml</param-value>
                   </context-param>
                  
                   <!-- Disable facelet refreshing -->
                   <context-param>
                   <param-name>facelets.REFRESH_PERIOD</param-name>
                   <param-value>${facelets.refresh}</param-value>
                   </context-param>
                  
                   <!-- Jsf optimization using recommendations from Jboss seam wiki -->
                   <context-param>
                   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                   <param-value>server</param-value>
                   </context-param>
                   <context-param>
                   <param-name>facelets.BUFFER_SIZE</param-name>
                   <param-value>500000</param-value>
                   </context-param>
                   <context-param>
                   <param-name>org.apache.myfaces.SERIAL_FACTORY</param-name>
                   <param-value>org.apache.myfaces.JbossSerialFactory</param-value>
                   </context-param>
                   <filter>
                   <display-name>Ajax4jsf Filter</display-name>
                   <filter-name>ajax4jsf</filter-name>
                   <filter-class>org.ajax4jsf.FastFilter</filter-class>
                   <init-param>
                   <param-name>forceparser</param-name>
                   <param-value>false</param-value>
                   </init-param>
                   </filter>
                   <filter-mapping>
                   <filter-name>ajax4jsf</filter-name>
                   <url-pattern>*.seam</url-pattern>
                   <dispatcher>REQUEST</dispatcher>
                   <dispatcher>FORWARD</dispatcher>
                   <dispatcher>INCLUDE</dispatcher>
                   </filter-mapping>
                  </web-app>
                  


                  Do you see anything weird there?


                  Cheers,
                  /Benoit

                  • 6. Re: Problem with 3.2.2.GA and simple echo
                    benoit.heinrich

                    I forgot to put the stack trace:

                    java.lang.NullPointerException
                     at java.lang.String.startsWith(String.java:1252)
                     at java.lang.String.startsWith(String.java:1281)
                     at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:189)
                     at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:222)
                     at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:139)
                     at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500)
                     at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                    



                    Cheers,
                    /Benoit

                    • 7. Re: Problem with 3.2.2.GA and simple echo
                      ilya_shaikovsky

                      1) http://www.jboss.com/index.html?module=bb&op=viewtopic&t=128558
                      2) remove ajax4jsf filter its nor needed using seam.
                      3) in general do not define any filters before the seam or ajax4jsf one in web.xml.

                      • 8. Re: Problem with 3.2.2.GA and simple echo

                        I have the same problem with weblogic 10.3. Is the first time I use WL. With jBoss is fine. But now it is not working.

                        I have the same stack log error.

                        my web.xml

                        <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
                         <display-name>SxS</display-name>
                        
                        
                         <welcome-file-list>
                         <welcome-file>index.html</welcome-file>
                         <welcome-file>index.htm</welcome-file>
                         <welcome-file>index.jsp</welcome-file>
                         <welcome-file>default.html</welcome-file>
                         <welcome-file>default.htm</welcome-file>
                         <welcome-file>default.jsp</welcome-file>
                         </welcome-file-list>
                        
                        
                        
                         <!-- context-param>
                         <param-name>javax.faces.CONFIG_FILES</param-name>
                         <param-value>/WEB-INF/faces-config.xml</param-value>
                         </context-param>
                         -->
                        
                         <filter>
                         <display-name>richfaces Filter</display-name>
                         <filter-name>richfaces</filter-name>
                         <filter-class>org.ajax4jsf.Filter</filter-class>
                        
                         </filter>
                         <filter-mapping>
                         <filter-name>richfaces</filter-name>
                         <servlet-name>Faces Servlet</servlet-name>
                         <dispatcher>REQUEST</dispatcher>
                         <dispatcher>FORWARD</dispatcher>
                         <dispatcher>INCLUDE</dispatcher>
                         </filter-mapping>
                        
                         <context-param>
                         <param-name>contextConfigLocation</param-name>
                         <param-value>/WEB-INF/applicationContext*.xml</param-value>
                         </context-param>
                        
                        
                        
                         <listener>
                         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
                         </listener>
                        
                         <servlet-mapping>
                         <servlet-name>Faces Servlet</servlet-name>
                         <url-pattern>*.jsf</url-pattern>
                         </servlet-mapping>
                        
                         <servlet-mapping>
                         <servlet-name>Faces Servlet</servlet-name>
                         <url-pattern>/faces/*</url-pattern>
                        
                         </servlet-mapping>
                        
                         <servlet>
                         <servlet-name>Faces Servlet</servlet-name>
                         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                         <load-on-startup>1</load-on-startup>
                         </servlet>
                        
                        
                        
                        </web-app>