7 Replies Latest reply on Feb 12, 2010 10:10 AM by Phil Wilson

    Problem with jsf 1.2 richfaces spring facelets

    Phil Wilson Newbie

      Hi guys,

       

      I am trying to upgrade our app with JSF 1.2 and RichFaces 3.3.2sr.

       

      I am getting this error? Can Anyone help ??

       

      13:17:23,975 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered : /org/richfaces/ui.pack.js%20type=%22text/javascript%22%3E%
              at org.ajax4jsf.resource.ResourceBuilderImpl.getResource(ResourceBuilderImpl.java:406)
              at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceForKey(ResourceBuilderImpl.java:350)
              at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:152)
              at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:508)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.ets.smores.web.common.authentication.SmoresAuthenticationFilter.doFilter(SmoresAuthenticationFilter.java:52)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)

       

       

      This is our 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">

       

          <!--  Resolution Spring related entried -->
           
          <context-param>
              <param-name>org.ajax4jsf.SKIN</param-name>
              <param-value>blueSky</param-value>
          </context-param>

       

      <context-param>
         <param-name>org.richfaces.LoadStyleStrategy</param-name>
         <param-value>ALL</param-value>
      </context-param>
      <context-param>
         <param-name>org.richfaces.LoadScriptStrategy</param-name>
         <param-value>ALL</param-value>
      </context-param>
        <context-param>
            <param-name>org.richfaces.CONTROL_SKINNING</param-name>
            <param-value>enable</param-value>
        </context-param>

       

          <context-param>
              <param-name>contextConfigLocation</param-name>
              <param-value>
                  classpath*:/applicationContext.xml
                  /WEB-INF/resolution-service.xml classpath:/sms-unittest.xml
                  classpath:/sms-data.xml classpath:/sms-service.xml
                  classpath:/sms-wrcreators.xml classpath:/sms-messages.xml
                  classpath:/sms-exceptionhandlers.xml
                  classpath:/sms-wrservice.xml classpath:/sms-wrprocess.xml
              </param-value>
          </context-param>
       
          <context-param>
              <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
              <param-value>true</param-value>
          </context-param>
          <!-- Bootstraps the root Spring Web Application Context, responsible for deploying managed beans
              defined in the configuration files above.  These beans represent the services used by the JSF application. -->

       

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

       

        <context-param>
          <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
          <param-value>.jsp</param-value>
        </context-param>

       

        <!-- Facelets pages will use the .xhtml extension -->
        <context-param>
          <param-name>facelets.VIEW_MAPPINGS</param-name>
          <param-value>*.xhtml</param-value>
        </context-param>

       

          <filter>
              <filter-name>resolutionOpenSessionInViewFilter</filter-name>
              <filter-class>
                  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
              </filter-class>
          </filter>
          <filter-mapping>
              <filter-name>resolutionOpenSessionInViewFilter</filter-name>
              <url-pattern>*.jsp</url-pattern>
          </filter-mapping>  

       

         
         
          <!--  End Resolution Spring related entried -->

       

          <context-param>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>server</param-value>
          </context-param>
          <context-param>
              <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
              <param-value>false</param-value>
          </context-param>
          <context-param>
              <param-name>javax.faces.CONFIG_FILES</param-name>
              <param-value>
                  /WEB-INF/tiles-defs.xml,/WEB-INF/faces-config-treenavigation.xml
              </param-value>
          </context-param>
          <!-- /WEB-INF/faces-config-scroller.xml, -->

       


          <listener>
              <listener-class>
                  com.sun.faces.config.ConfigureListener
              </listener-class>
          </listener>
          <listener>
              <listener-class>
                  org.ets.smores.web.util.SmoresContextListener
              </listener-class>
          </listener>
          <jsp-config>
              <taglib>
                  <taglib-uri>/WEB-INF/my_custom_tags.tld</taglib-uri>
                  <taglib-location>
                      /WEB-INF/my_custom_tags.tld
                  </taglib-location>
              </taglib>
          </jsp-config>

       


          <!-- Faces Servlet -->
            <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            </servlet>
          
            <!-- Use prefix mapping for Facelets pages, e.g. http://localhost:8080/webapp/faces/mypage.xhtml -->
            <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>/faces/*</url-pattern>
            </servlet-mapping>

       

          <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>
         
          <!-- ajax for jsf -->

       

          <filter>
              <display-name>Ajax4jsf Filter</display-name>
              <filter-name>ajax4jsf</filter-name>
              <filter-class>org.ajax4jsf.Filter</filter-class>
          </filter>
          <filter-mapping>
              <filter-name>ajax4jsf</filter-name>
              <servlet-name>Faces Servlet</servlet-name>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
              <dispatcher>INCLUDE</dispatcher>
          </filter-mapping>  

       

          <filter>
              <filter-name>authenticationFilter</filter-name>
              <filter-class>
                  org.ets.smores.web.common.authentication.SmoresAuthenticationFilter
              </filter-class>
          </filter>
         
          <filter-mapping>
              <filter-name>authenticationFilter</filter-name>
              <url-pattern>/*</url-pattern>
          </filter-mapping>

       

          <filter>
              <filter-name>extensionsFilter</filter-name>
              <filter-class>
                  org.apache.myfaces.webapp.filter.ExtensionsFilter
              </filter-class>
              <init-param>
                  <description>
                      Set the size limit for uploaded files. Format: 10 - 10
                      bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
                  </description>
                  <param-name>uploadMaxFileSize</param-name>
                  <param-value>100m</param-value>
              </init-param>
              <init-param>
                  <description>
                      Set the threshold size - files below this limit are
                      stored in memory, files above this limit are stored on
                      disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g -
                      1 GB
                  </description>
                  <param-name>uploadThresholdSize</param-name>
                  <param-value>100k</param-value>
              </init-param>
          </filter>

       

          <filter-mapping>
              <filter-name>extensionsFilter</filter-name>
              <url-pattern>/faces/*</url-pattern>
          </filter-mapping>

       

       

       

         
          <!-- JSF Tiles Integration -->
          <servlet>
              <servlet-name>TilesServet</servlet-name>
              <servlet-class>
                  org.apache.tiles.web.startup.TilesServlet
              </servlet-class>
              <init-param>
                  <param-name>
                      org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
                  </param-name>
                  <param-value>/WEB-INF/tiles-defs.xml</param-value>
              </init-param>
              <load-on-startup>2</load-on-startup>
          </servlet>

       


          <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
          </welcome-file-list>

       


      </web-app>

        • 1. Re: Problem with jsf 1.2 richfaces spring facelets
          Phil Wilson Newbie

          jar's we are using.

           

          richfaces-api-3.3.2.SR1.jar
          richfaces-impl-3.3.2.SR1.jar
          richfaces-ui-3.3.2.SR1.jar
          tomahawk-1.1.9.jar
          tiles-jsp-2.2.1.jar
          tiles-core-2.2.1.jar
          tiles-api-2.2.1.jar
          jsp-api-2.1-6.0.0.jar
          jsf-facelets_1_1_15.jar
          jsf-impl_1_2.jar
          jsf-api_1_2.jar

          • 2. Re: Problem with jsf 1.2 richfaces spring facelets
            Ilya Shaikovsky Master

            1) RichFaces filter should be first in filters chain. So move it above the others in web.xml. And consider that filters with url-pattern registered first according to specification no matter if defined ablove or below filters with servlet-name.

             

            2) you defined a4j and RF filters. remove one of them - it's just the same definitions.

            • 3. Re: Problem with jsf 1.2 richfaces spring facelets
              Phil Wilson Newbie

              ok..Thanks for the reply.

               

              I moved the filter up. I am getting this error now.

               

               

              XML Parsing Error: syntax error
              Location: http://localhost:8080/smores/faces/pages/home.jsp
              Line Number 1, Column 1:

               

               

               

               

              This happens during our login process. It goes thru a controller then returns a string, in faces-config.xml.

              Note: this worked in a previous version. Until we upgraded RichFaces and jsf 1.2

               

              <h:commandLink  id="signIn"  action="#{loginController.performLogin}" value="Sign In"></h:commandLink>

               

              controller.performLogin

               

                          logger.info("*********************************************************");
                          logger.info("                       successPFW                        ");
                          logger.info("*********************************************************");
                         
                          return "successPFW";

               

              faces-config.xml.

               

              <navigation-rule>
                      <from-view-id>/pages/home.jsp</from-view-id>
                      <navigation-case>
                          <from-outcome>successPFW</from-outcome>
                          <to-view-id>/pages/userhome.jsp</to-view-id>
                      </navigation-case>
                  </navigation-rule>   
                 
                  <navigation-rule>
                      <from-view-id>*</from-view-id>
                      <navigation-case>
                          <from-action>#{loginController.performLogin}</from-action>
                          <from-outcome>successPFW</from-outcome>
                          <to-view-id>/pages/userhome.jsp</to-view-id>
                      </navigation-case>
                  </navigation-rule>  

               

              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">
                 
                  <!--  Resolution Spring related entried -->
                   
                  <context-param>
                      <param-name>org.ajax4jsf.SKIN</param-name>
                      <param-value>blueSky</param-value>
                  </context-param>

               

              <context-param>
                 <param-name>org.richfaces.LoadScriptStrategy</param-name>
                 <param-value>ALL</param-value>
              </context-param>

                <context-param>
                    <param-name>org.richfaces.CONTROL_SKINNING</param-name>
                    <param-value>enable</param-value>
                </context-param>

               

                  <context-param>
                      <param-name>contextConfigLocation</param-name>
                      <param-value>
                          classpath*:/applicationContext.xml
                          /WEB-INF/resolution-service.xml classpath:/sms-unittest.xml
                          classpath:/sms-data.xml classpath:/sms-service.xml
                          classpath:/sms-wrcreators.xml classpath:/sms-messages.xml
                          classpath:/sms-exceptionhandlers.xml
                          classpath:/sms-wrservice.xml classpath:/sms-wrprocess.xml
                      </param-value>
                  </context-param>
               
                  <context-param>
                      <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
                      <param-value>true</param-value>
                  </context-param>
                  <!-- Bootstraps the root Spring Web Application Context, responsible for deploying managed beans
                      defined in the configuration files above.  These beans represent the services used by the JSF application. -->

               

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

               

                <context-param>
                  <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                  <param-value>.jsp</param-value>
                </context-param>

               

                <!-- Facelets pages will use the .xhtml extension -->
                <context-param>
                  <param-name>facelets.VIEW_MAPPINGS</param-name>
                  <param-value>*.xhtml</param-value>
                </context-param>
               
               

               

                 
                 
                  <!--  End Resolution Spring related entried -->

               

                  <context-param>
                      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                      <param-value>server</param-value>
                  </context-param>
                  <context-param>
                      <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
                      <param-value>false</param-value>
                  </context-param>
                  <context-param>
                      <param-name>javax.faces.CONFIG_FILES</param-name>
                      <param-value>
                          /WEB-INF/tiles-defs.xml,/WEB-INF/faces-config-treenavigation.xml
                      </param-value>
                  </context-param>
                  <!-- /WEB-INF/faces-config-scroller.xml, -->

               


                  <listener>
                      <listener-class>
                          com.sun.faces.config.ConfigureListener
                      </listener-class>
                  </listener>
                  <listener>
                      <listener-class>
                          org.ets.smores.web.util.SmoresContextListener
                      </listener-class>
                  </listener>
                  <jsp-config>
                      <taglib>
                          <taglib-uri>/WEB-INF/my_custom_tags.tld</taglib-uri>
                          <taglib-location>
                              /WEB-INF/my_custom_tags.tld
                          </taglib-location>
                      </taglib>
                  </jsp-config>

               


                  <!-- Faces Servlet -->
                    <servlet>
                      <servlet-name>Faces Servlet</servlet-name>
                      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                    </servlet>
                  
                    <!-- Use prefix mapping for Facelets pages, e.g. http://localhost:8080/webapp/faces/mypage.xhtml -->
                    <servlet-mapping>
                      <servlet-name>Faces Servlet</servlet-name>
                      <url-pattern>/faces/*</url-pattern>
                    </servlet-mapping>

               


                  <!-- ajax for jsf -->
                  
                    <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>

               

                  <filter>
                      <filter-name>resolutionOpenSessionInViewFilter</filter-name>
                      <filter-class>
                          org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
                      </filter-class>
                  </filter>
                  <filter-mapping>
                      <filter-name>resolutionOpenSessionInViewFilter</filter-name>
                      <url-pattern>*.jsp</url-pattern>
                  </filter-mapping>

               

                  <filter>
                      <filter-name>authenticationFilter</filter-name>
                      <filter-class>
                          org.ets.smores.web.common.authentication.SmoresAuthenticationFilter
                      </filter-class>
                  </filter>
                 
                  <filter-mapping>
                      <filter-name>authenticationFilter</filter-name>
                      <url-pattern>/*</url-pattern>
                  </filter-mapping>

               

                  <filter>
                      <filter-name>extensionsFilter</filter-name>
                      <filter-class>
                          org.apache.myfaces.webapp.filter.ExtensionsFilter
                      </filter-class>
                      <init-param>
                          <description>
                              Set the size limit for uploaded files. Format: 10 - 10
                              bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
                          </description>
                          <param-name>uploadMaxFileSize</param-name>
                          <param-value>100m</param-value>
                      </init-param>
                      <init-param>
                          <description>
                              Set the threshold size - files below this limit are
                              stored in memory, files above this limit are stored on
                              disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g -
                              1 GB
                          </description>
                          <param-name>uploadThresholdSize</param-name>
                          <param-value>100k</param-value>
                      </init-param>
                  </filter>

               

                  <filter-mapping>
                      <filter-name>extensionsFilter</filter-name>
                      <url-pattern>/faces/*</url-pattern>
                  </filter-mapping>

               

               

               

                 
                  <!-- JSF Tiles Integration -->
                  <servlet>
                      <servlet-name>TilesServet</servlet-name>
                      <servlet-class>
                          org.apache.tiles.web.startup.TilesServlet
                      </servlet-class>
                      <init-param>
                          <param-name>
                              org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
                          </param-name>
                          <param-value>/WEB-INF/tiles-defs.xml</param-value>
                      </init-param>
                      <load-on-startup>2</load-on-startup>
                  </servlet>

               


                  <welcome-file-list>
                      <welcome-file>index.jsp</welcome-file>
                  </welcome-file-list>

               


              </web-app>

              • 4. Re: Problem with jsf 1.2 richfaces spring facelets
                Ilya Shaikovsky Master
                Moving the thread to RichFaces space as this space designed only for RF development topics.
                • 5. Re: Problem with jsf 1.2 richfaces spring facelets
                  Ilya Shaikovsky Master
                  pages code snippets would be also helpfull.
                  • 6. Re: Problem with jsf 1.2 richfaces spring facelets
                    Phil Wilson Newbie

                    Thanks for your response.

                    This is where I am with this issue.

                    I have put a test page in with a simple richfaces dropdown menu.

                    It works and navigates to the correct pages.

                     

                    The problem is from the login page when it hits the controller. The logger output shows it is correctly working with ldap login. The controller returns a string of

                    return "successPFW";

                     

                    faces-config.xml
                    <?xml version="1.0" encoding="UTF-8"?>
                    <faces-config version="1.2"
                                        xmlns="http://java.sun.com/xml/ns/javaee"
                                        xmlns:xi="http://www.w3.org/2001/XInclude"
                                        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">   

                        <navigation-rule>
                            <from-view-id>*</from-view-id>
                            <navigation-case>
                                <from-outcome>successPFW</from-outcome>
                                <to-view-id>userhome.jsp</to-view-id>
                            </navigation-case>
                        </navigation-rule>  

                     

                    This is the error I get from IE

                     

                    The XML page cannot be displayed

                    Cannot view XML input using style sheet.  Please correct the error and then click the Refresh button, or try  again later.


                    Invalid at the top level of the document.  Error processing resource  'http://localhost:8080/smores/faces/pages/home.jsp;jses...

                    SUCCESS:::null


                     

                    I get this from FireFox

                    XML Parsing Error: syntax error
                    Location: http://localhost:8080/smores/faces/pages/home.jsp
                    Line Number 1, Column 1:SUCCESS:::null

                     

                    From Jboss Logs

                    15:07:17,289 INFO  [LoginController] *********************************************************
                    15:07:17,289 INFO  [LoginController]                        successPFW
                    15:07:17,289 INFO  [LoginController] *********************************************************

                     

                     

                    I am not seeing any errors at all. I wonder if it is a conflict in jars.

                     

                    Any help or comments are welcome.

                     

                    Thanks

                    Phil

                     

                     

                     

                     

                    • 7. Re: Problem with jsf 1.2 richfaces spring facelets
                      Phil Wilson Newbie

                      I think I found the issue...

                       

                      Deep in the application they are

                       

                                  ctx.getExternalContext().getSessionMap().put("SmoresUser",smoresUser);
                                  FacesUtil.writeOnResponse(ctx,"SUCCESS:::"+loginForm.getSystem());

                                  .....

                                  ctx.responseComplete();

                       

                      From what I found this does :

                       

                      Scenario 2: Faces Request Generates Non-Faces Response

                      Sometimes a JavaServer Faces application might need to redirect to a different web application resource or might need to generate a response that does not contain any JavaServer Faces components. In these situations, the developer must skip the rendering phase (Render Response Phase) by calling FacesContext.responseComplete. The FacesContext contains all the information associated with a particular Faces request. This method can be invoked during the Apply Request Values Phase, Process Validations Phase, or the Update Model Values Phase.

                       

                      http://ermalaev.spb.ru/j2ee/1.4/docs/tutorial-update6/doc/JSFIntro10.html

                       

                      I am working to find a fix. The application is big and this stuff is all thru it.

                       

                      Thanks

                      Phil