10 Replies Latest reply on Jul 3, 2013 8:58 AM by jrodalo

    RF issues after migrating to JSF 2.1.22

    strannik

      Hi

       

      I am using RF 4.3.2. in my application.

       

      After I've migrated from Mojarra 2.1.15 to 2.1.22 I started experiencing the following issues:

       

      -- The application pages looked inconsistent

      -- There are multiple lines in the console log, like

      ReferenceError: toolbarHandlers is not defined

       

      After downgrading to Mojarra 2.1.15 the issues disappeared.

      Please advise on this issue.

        • 1. Re: RF issues after migrating to JSF 2.1.22
          ppitonak

          Hi Sergey,

           

          I tried our testing application Metamer with Mojarra 2.1.22 on Tomcat 7.0.35 and everything seems to work fine. All components look normal in web browser, there are no JavaScript errors and no errors in server log. Could you please provide more information about your project?

           

          Regards,

          Palo

          • 2. Re: RF issues after migrating to JSF 2.1.22
            strannik

            Hi, Pavol.

             

            Thank you for quick answer.

            I use:

             

            -- RF 4.3.2

            -- Mojarra 2.1.22

            -- Spring 3.2.3

            -- Spring Web Flow 2.3.2

            • 3. Re: RF issues after migrating to JSF 2.1.22
              conchord

              Hi Sergey,

               

              I have some weird problems using those versions too. When opening the page for the first time there are some scripts that aren't included but if I refresh the page (F5) everything loads perfect. I don't know why...

               

              The first time loads only this scripts:

               

              - richfaces.js

              - richfaces-event.js

              - richfaces-csv.js

              - jquery.js

               

              And I get this errors on Chrome DevTools:

               

              Uncaught ReferenceError: RichFaces is not defined

              Uncaught TypeError: Cannot read property 'Message' of undefined

               

              Refreshing the pages loads the other scripts and the errors disapears:

               

              - richfaces-queue.js

              - richfaces-base-component.js

              - status.js

              - message.js

              - jsf.js

               

              Using Mojarra 2.1.21 solves this problems for me but I'm now fighting with a very simple h:dataTable that don't render anything inside...

              • 4. Re: RF issues after migrating to JSF 2.1.22
                lfryc

                The 'RichFaces' is not defined because it depends on jsf.js that isn't loaded on initial load.

                 

                Could you try to clear a browser cache and try again from a clean state?

                • 5. Re: RF issues after migrating to JSF 2.1.22
                  conchord

                  Hi Lukáš,

                   

                  After clearing the cache I still have the same problem.

                   

                  I tried to simplify the example to post the results here. My page now has only this code:

                   

                  <a href="/richfaces/test.htm">Link</a>
                  
                  <h:form>
                      <rich:editor />
                  </h:form>
                  

                   

                  And this is the HTML rendered in the first load (following a link to the page or typing the url in the browser):

                   

                  <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head>
                      <title>RichFaces</title>
                  </head>
                  <body>
                  
                      <a href="/richfaces/test.htm">Link</a>
                  
                      <form id="j_idt6" name="j_idt6" method="post" action="/richfaces/test.htm?execution=e3s1" enctype="application/x-www-form-urlencoded">
                  
                          <input type="hidden" name="j_idt6" value="j_idt6" />
                  
                          <div class="rf-ed" id="j_idt6:j_idt7">
                              <textarea class="rf-ed-inp" id="j_idt6:j_idt7:inp" name="j_idt6:j_idt7" style="width: 100%; height: 200px; "></textarea>
                              <script id="j_idt6:j_idt7Script" type="text/javascript">
                                  window.CKEDITOR_BASEPATH = '/richfaces/org.richfaces.resources/javax.faces.resource/org.richfaces.ckeditor/';
                                  window.CKEDITOR_GETURL = function(resource)  {
                                      if (match = resource.match(/([a-z]+).ecss$/)) {
                                          switch (match[1]) {
                                              case "editor" : return resource + '?db=eAHjW!XqPQAE!QKS';
                                              case "dialog" : return resource + '?db=eAHjW!XqPQAE!QKS';
                                          }
                                      }
                                  };
                                  
                                  (function() {
                                      var options = null;
                                      var config = {};
                                      
                                      new RichFaces.ui.Editor("j_idt6:j_idt7", options, config);
                                  })();
                              </script>
                          </div>
                  
                          <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="e3s1" />
                      </form>
                  
                  </body>
                  </html>
                  

                   

                  It doesn't matter how many times I click on the link to this page, it's always rendered the same way (without the scripts). But if I hit refresh (F5) then it renders this HTML:

                   

                  <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head>
                      <title>RichFaces</title>
                      
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/jsf.js.htm?ln=javax.faces&amp;stage=Development"></script>
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/jquery.js.htm"></script>
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/richfaces.js.htm"></script>
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/richfaces-queue.js.htm"></script>
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/richfaces-base-component.js.htm"></script>
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/richfaces-event.js.htm"></script>
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/richfaces-utils.js.htm"></script>
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/editor.js.htm?ln=org.richfaces"></script>
                  
                  </head>
                  <body>
                  
                      <a href="/richfaces/test.htm">Link</a>
                  
                      <form id="j_idt6" name="j_idt6" method="post" action="/richfaces/test.htm?execution=e3s1" enctype="application/x-www-form-urlencoded">
                  
                          <input type="hidden" name="j_idt6" value="j_idt6" />
                  
                          <div class="rf-ed" id="j_idt6:j_idt7">
                              <textarea class="rf-ed-inp" id="j_idt6:j_idt7:inp" name="j_idt6:j_idt7" style="width: 100%; height: 200px; "></textarea>
                              <script id="j_idt6:j_idt7Script" type="text/javascript">
                                  window.CKEDITOR_BASEPATH = '/richfaces/org.richfaces.resources/javax.faces.resource/org.richfaces.ckeditor/';
                                  window.CKEDITOR_GETURL = function(resource)  {
                                      if (match = resource.match(/([a-z]+).ecss$/)) {
                                          switch (match[1]) {
                                              case "editor" : return resource + '?db=eAHjW!XqPQAE!QKS';
                                              case "dialog" : return resource + '?db=eAHjW!XqPQAE!QKS';
                                          }
                                      }
                                  };
                                  
                                  (function() {
                                      var options = null;
                                      var config = {};
                                      
                                      new RichFaces.ui.Editor("j_idt6:j_idt7", options, config);
                                  })();
                              </script>
                          </div>
                  
                          <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="e3s1" />
                      </form>
                  
                      <script type="text/javascript" src="/richfaces/javax.faces.resource/ckeditor.js.htm?ln=org.richfaces.ckeditor"></script>
                      
                  </body>
                  </html>
                  

                   

                  With scripts included in the h:head and without js errors.

                   

                  If I downgrade Mojarra to 2.1.21 in pom.xml everything works fine, without changing anything else. It must be something with 2.1.22

                   

                  Thanks!

                  • 6. Re: RF issues after migrating to JSF 2.1.22
                    lfryc

                    Hey Bret,

                     

                    I'm pretty sure you are hitting Mojarra issue,

                     

                    regrettably we are not able to reproduce it locally (as Pavol told you).

                     

                    Could you possibly create a very simple app which would demonstrate a case so we could investigate more? [1]

                     

                    You can use input-demo as a base [2].

                     

                    [1] https://community.jboss.org/wiki/SubmittingEffectiveIssueReports

                    [2] https://github.com/richfaces4/dev-examples/tree/master/input-demo

                    • 7. Re: RF issues after migrating to JSF 2.1.22
                      conchord

                      Hi Lukáš,

                       

                      I've attached a demo project with this issue. I've discovered that only happens with Spring WebFlow pages, not in a regular facelets page.

                       

                      Probably because of one of this changes:  https://java.net/jira/secure/ReleaseNote.jspa?projectId=10204&version=16357 ?

                       

                      Thanks!

                      1 of 1 people found this helpful
                      • 8. Re: RF issues after migrating to JSF 2.1.22
                        lfryc

                        Hey Brett,

                         

                        great job with investigations.

                         

                        Would you mind to report those issues to both, Spring Web Flow and Mojarra projects, and hyperlink them?

                         

                        I'm afraid we can't do anything about it, since we depend here on JSF/Mojarra resource loading.

                         

                         

                        Thanks,

                         

                        ~ Lukas

                        • 9. Re: RF issues after migrating to JSF 2.1.22
                          strannik

                          Thank you, Bret!

                           

                          You did a fantastic job.

                          • 10. Re: RF issues after migrating to JSF 2.1.22
                            jrodalo

                            I had the same issue described here. It's already fixed in Mojarra 2.1.23

                             

                            https://java.net/jira/secure/ReleaseNote.jspa?projectId=10204&version=16440