12 Replies Latest reply on Aug 31, 2015 11:03 AM by vmelnikov

    RichFaces Issue: Resource not registered

    rmcdonough

      We are working a Seam (2.0.1) based applications which uses Spring, Hibernate (3.2.5) and RichFaces (3.1.4SR1) on Weblogic 9.2 using the JSF RI. We are now running into an issue where we keep getting the following exception on screens which use ajax components:



      org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered : /org/richfaces/ui.pack.js.seam
           at org.ajax4jsf.resource.ResourceBuilderImpl.getResource(ResourceBuilderImpl.java:390)
           at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceForKey(ResourceBuilderImpl.java:334)
           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:265)
           Truncated. see log file for complete stacktrace




      We've reverted out web.xml a number of times, but the issue persists. We have read that this maybe a browser caching issue, and we've tried that and the issue remains. Any insight would be greatly appreciated.


      Here's how we have our web.xml set up:



      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4" 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">
           <display-name>Admin App</display-name>
           <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
           </context-param>
           <context-param>
                <param-name>facelets.REFRESH_PERIOD</param-name>
                <param-value>2</param-value>
           </context-param>
           <context-param>
                <param-name>facelets.DEVELOPMENT</param-name>
                <param-value>true</param-value>
           </context-param>
           <context-param>
                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                <param-value>client</param-value>
           </context-param>
      
      
           <context-param>
                <param-name>org.ajax4jsf.SKIN</param-name>
                <param-value>blueSky</param-value>
           </context-param>
           
           <listener>
                <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
           </listener>
           <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class> org.jboss.seam.servlet.SeamFilter </filter-class>
           </filter>
           <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
           </filter-mapping>
           <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>
      
           <!--  ajax4jsf -->
           <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>
                <dispatcher>ERROR</dispatcher>
           </filter-mapping>
      
      
           <!-- Faces Servlet -->
           <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>
      </web-app>




      And here's what out components.xml looks like:



      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components" 
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                  xmlns:spring="http://jboss.com/products/seam/spring"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:web="http://jboss.com/products/seam/web"
                  xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                  http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                  http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd
                  http://jboss.com/products/seam/spring http://jboss.com/products/seam/spring-2.0.xsd
                  http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd">
          <core:init debug="true"/>    
          
          <core:manager concurrent-request-timeout="500"
                        conversation-timeout="120000" 
                        conversation-id-parameter="cid"/>
          
          
          <!-- Enabling the debug property will generate an AJAX console (but you could just use FireBug) -->
          <component name="org.jboss.seam.remoting.remotingConfig">
              <property name="debug">false</property>
          </component>
          
          <web:exception-filter url-pattern="*.seam"/>
          
          <web:redirect-filter url-pattern="*.seam"/>
          
          <web:multipart-filter create-temp-files="true" 
                                 max-request-size="1000000" 
                                 url-pattern="*.seam"/>
                                 
           <!-- Add identity logging to the application. This filter adds the authenticated user name 
                to the log4j mapped diagnostic context so that it can be included in formatted log output 
                if desired, by adding %X{username} to the pattern -->
           <web:logging-filter url-pattern="*.seam"/>
           
           <web:ajax4jsf-filter force-parser="false" 
                                enable-cache="true" 
                                log4j-init-file="custom-log4j.xml"
                                url-pattern="*.seam"/>
                                
          
          <!-- Allows Seam to manage the Hibernate Session  -->
          <persistence:managed-hibernate-session name="hibernateSession" 
                                                 auto-create="true" 
                                                 session-factory="#{springSessionFactory}"/>
          
          <spring:context-loader />
          
          <!-- Install a ThreadPoolDispatcher to handle scheduled asynchronous event -->
          <core:thread-pool-dispatcher name="threadPoolDispatcher"/>
          
          <!-- Install the SpringDispatcher as default -->
          <spring:task-executor-dispatcher schedule-dispatcher="#{threadPoolDispatcher}" 
                                           task-executor="#{springThreadPoolTaskExecutor}"/>
          
          <!-- Set up the transaction Manager. The id must match the ID in the applicationContext.xml -->
          <spring:spring-transaction platform-transaction-manager="#{transactionManager}"/>
      </components>
      



        • 1. Re: RichFaces Issue: Resource not registered
          rmcdonough

          I should also point out that issue is not limited to just the javascript files but images used by RichFaces as well:


          org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered : images/spacer.gif.seam
               at org.ajax4jsf.resource.ResourceBuilderImpl.getResource(ResourceBuilderImpl.java:390)
               at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceForKey(ResourceBuilderImpl.java:334)
               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:265)
               Truncated. see log file for complete stacktrace
          


          Oddly, styles behave just fine. I just can't figure it out.


          Ryan-

          • 2. Re: RichFaces Issue: Resource not registered
            rmcdonough

            I should also point out that issue is not limited to just the javascript files but images used by RichFaces as well:


            org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered : images/spacer.gif.seam
                 at org.ajax4jsf.resource.ResourceBuilderImpl.getResource(ResourceBuilderImpl.java:390)
                 at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceForKey(ResourceBuilderImpl.java:334)
                 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:265)
                 Truncated. see log file for complete stacktrace
            


            Oddly, styles behave just fine. I just can't figure it out.


            Ryan-

            • 3. Re: RichFaces Issue: Resource not registered
              arvhatte

              I've updated to Seam 2.0.1 too and upgraded the Richfaces lib to 3.2.0.SR1 and ran into the same problem. So if anyone has solved this problem, please drop me a line as this problem is currently blocking our production release of an application.


              Thanks,

              Tim

              • 4. Re: RichFaces Issue: Resource not registered
                damianharvey.damianharvey.gmail.com

                Is anything actually broken though? This error can occur when you upgrade the Richfaces libs but don't clear your browser cache.


                Cheers,


                Damian.

                • 5. Re: RichFaces Issue: Resource not registered
                  sergeysmirnov.sim.exadel.com

                  This is only the problem with browser cache. Browser sends request for checking if the resource (image and so on) stored in the cache is changed. The cache works on the 12-hour bases. In case you just replace the library on the server, RichFaces recognize the request for resource that was not generated by this new version of library as a security violation. The exception occurs. Normally, it is harmless,  because the browser just show the old image by default (However, it depends of custom browser settings)


                  Ctrl-F5 in the browser cleans up the cache and eliminates the problem.

                  • 6. Re: RichFaces Issue: Resource not registered
                    arvhatte

                    The infamous 'ResourceNotFoundException' that is related to the use of Richfaces/Ajax4JSF has bugged me for quite some time now. I've read all kinds of possible solutions, ranging from the clearing of your browser cache to upgrading the Richfaces library and even some more exotic solutions (which, by the way, were not confirmed by anyone). And in my case, something is really broken, as the problem also occured on a newly installed PC with a newly installed browser en going to the web application for the first time.


                    In my case, all the solutions I could find on the internet did not solve the problem, but after downgrading my JDK and JRE version on the server from 1.6.0_06 to 1.5.0_14, the 'ResourceNotFoundException' was miraculously gone. I've got no clue to why the error does not occur anymore and if it is indeed a problem/incompatability with the Java 6 version of Richfaces, Seam of maybe even JBoss 4.2.x, but I do know my problem was solved by using Java 5 instead of Java 6.


                    So, for those that also run into the before mentioned 'ResourceNotFoundException', try the following and your problem will probably be solved:



                    1. Clear your browser''s cache (CTRL+F5 on IE)

                    2. Upgrade your Richfaces library to atleast 3.1.5 (as this version solved some issues related to this exception) or 3.2.0SR1

                    3. If you're using Java 6, downgrade to Java 5



                    • 7. Re: RichFaces Issue: Resource not registered
                      bharathiya

                      I have hit the same issue and could not solve it by the suggestions provided here.
                      Any further suggestions ?


                      Thanks,
                      Devil

                      • 8. Re: RichFaces Issue: Resource not registered
                        asookazian

                        Tim Blommerde wrote on May 06, 2008 09:47:


                        In my case, all the solutions I could find on the internet did not solve the problem, but after downgrading my JDK and JRE version on the server from 1.6.0_06 to 1.5.0_14, the 'ResourceNotFoundException' was miraculously gone. I've got no clue to why the error does not occur anymore and if it is indeed a problem/incompatability with the Java 6 version of Richfaces, Seam of maybe even JBoss 4.2.x, but I do know my problem was solved by using Java 5 instead of Java 6.



                        I had the same problem and it was solved by changing JAVA_HOME from 1.6 to 1.5. 


                        jboss-seam-2.0.1.GA.jar
                        richfaces-impl-3.2.1.GA.jar


                        thanks!

                        • 9. Re: RichFaces Issue: Resource not registered
                          deanhiller2000

                          we just went live in production and we are also getting these errors once in a while.  We have not done any upgrades yet!!!!


                          2010-03-02 10:27:08,179 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/scripts].[default]] (http-0.0.0.0-8080-9) N/A Servlet.service() for servlet default threw exception
                          org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered : org/richfaces/renderkit/html/scripnl-mask-div-transparent%20rich-mpnl-mask-div
                                  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:488)



                          We have two ERROR in production and then our logs will be clean as a whistle so our paging ops works very well as ERROR and WARN logs will only be real production issues.  As it is now, they are getting paged all the time because of this damn issue.  If it is not really an issue, maybe the log could be turned down to INFO?....should I just configure my pages file to do that or are there cases when they hit this that it really is an issue and I need ops to be paged???


                          thanks,
                          Dean

                          • 10. Re: RichFaces Issue: Resource not registered
                            deanhiller2000

                            and another in production....




                            2010-03-02 10:28:26,162 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/scripts].[default]] (http-0.0.0.0-8080-9) N/A Servlet.service() for servlet default threw exception
                            org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered : oResizerSWU
                                    at org.ajax4jsf.resource.ResourceBuilderImpl.getResource(ResourceBuilderImpl.java:406)
                                    at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceForKey(ResourceBuilderImpl.java:350)
                            



                            • 11. Re: RichFaces Issue: Resource not registered
                              bk1_168

                              Going to Java 1.5 is not really an option for most projects, because Java 1.6 is mandatory due to general requirements or simply because of the usage of 1.6-features.


                              But maybe the fact that it works with 1.5 can help access the root cause of this problem?  What is done here that works with 1.5 and sporadically discontinues to work with 1.6??


                              Karl

                              • 12. Re: RichFaces Issue: Resource not registered
                                vmelnikov

                                You should exclude second initialization of org.ajax4jsf.Filter in filter and filter-mapping sections of web.xml. Seam instantiate org.ajax4jsf.Filter from Ajax4jsfFilterInstantiator class.

                                Please remove following code from web.xml