9 Replies Latest reply on Mar 17, 2008 11:57 AM by freemarket

    JS error: 'null' is null or is not an object

    shooali

      Hi,

      I am getting this error (null is null or is not an object) in one of our pages.
      while debugging, I see it happens in

      $("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent();}}


      I have searched the forum and saw posts from Sergey that the problem is inconsistency of the prototype.js file used in richfaces and the one used by tomahawk. so I have pathced tomahawk jar and put there the prototype.js file I have took from the richfaces-ui-3.1.4.jar but the problem stays. I have cleared the IE cache. nothing helps.

      please advise,

      thanks

      Shooali

        • 1. Re: JS error: 'null' is null or is not an object

          Try to delete prototype js lib from tomahawk jar.
          This will be a problem if you have jsf with tomahawk and with no rich components, but you can always add one rich component to your page.
          By the way, using tomahawk and rich together can cause critical problems.

          • 2. Re: JS error: 'null' is null or is not an object
            shooali

            thanks, I will try it out.

            • 3. Re: JS error: 'null' is null or is not an object
              freemarket

              Hi,

              I receive the same "null is null..." error using:
              richfaces 3.1.4GA
              facelets: 1.1.12

              I also receive this javascript error:

              A Runtime Error has occurred.
              Do you with to Debug?

              Line: 118
              Error: Out of memory

              My web app uses the following libraries:

              -rwx------ 1 hkatz mkpasswd 188671 Dec 20 16:41 commons-beanutils-1.7.0.jar
              -rwx------ 1 hkatz mkpasswd 571259 Dec 20 16:39 commons-collections-3.2.jar
              -rwx------ 1 hkatz mkpasswd 143602 Dec 20 16:42 commons-digester-1.8.jar
              -rwx------ 1 hkatz mkpasswd 38015 Dec 20 16:37 commons-logging-1.0.4.jar
              -rwx------ 1 hkatz mkpasswd 85587 Feb 5 15:43 ibatis-common-2.jar
              -rwx------ 1 hkatz mkpasswd 61191 Feb 5 15:43 ibatis-dao-2.jar
              -rwx------ 1 hkatz mkpasswd 322368 Feb 5 15:43 ibatis-sqlmap-2.jar
              -rwx------ 1 hkatz mkpasswd 93310 Dec 20 16:51 jhighlight-1.0.jar
              -rwx------ 1 hkatz mkpasswd 323012 Dec 20 17:00 jsf-api-1.2_04-p02.jar
              -rwx------ 1 hkatz mkpasswd 298368 Dec 20 16:41 jsf-facelets-1.1.12.jar
              -rwx------ 1 hkatz mkpasswd 1210046 Dec 20 17:00 jsf-impl-1.2_04-p02.jar
              -rwx------ 1 hkatz mkpasswd 20801 Dec 20 16:42 jstl-1.0.jar
              -rwx------ 1 hkatz mkpasswd 105672 Dec 20 16:42 nekohtml-0.9.5.jar
              -rwx------ 1 hkatz mkpasswd 1536554 Feb 5 15:49 ojdbc14.jar
              -rwx------ 1 hkatz mkpasswd 2073 Feb 7 10:01 phaseTracker.jar
              -rwx------ 1 hkatz mkpasswd 117592 Jan 29 15:32 richfaces-api-3.1.4.GA.jar
              -rwx------ 1 hkatz mkpasswd 1304705 Jan 29 15:32 richfaces-impl-3.1.4.GA.jar
              -rwx------ 1 hkatz mkpasswd 1795998 Jan 29 15:46 richfaces-ui-3.1.4.GA.jar
              -rwx------ 1 hkatz mkpasswd 895924 Dec 20 16:42 xercesImpl-2.4.0.jar
              


              only the richfaces jar contains prototype.js:

              $ for i in *jar; do jar tvf $i |grep -i prototype\.js; done
              128080 Tue Jan 29 15:32:16 EST 2008 org/ajax4jsf/javascript/scripts/prototype.js
              $


              Any explanations?

              Thanks,
              Henry

              • 4. Re: JS error: 'null' is null or is not an object
                softbinder

                Hi,

                I am having the same problem. I cannot upgrade from 3.1.2 to 3.1.4 since I get this JS error in pages with modal panel or calendar

                please advice,

                thanks

                • 5. Re: JS error: 'null' is null or is not an object

                   

                  "freemarket" wrote:


                  Line: 118
                  Error: Out of memory


                  Do you use a4j:log on the page?

                  • 6. Re: JS error: 'null' is null or is not an object

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

                    <context-param>
                    <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
                    <param-value>false</param-value>
                    </context-param>
                    From your XML.
                    I know you get performance penelty, but it works for me.

                    • 7. Re: JS error: 'null' is null or is not an object
                      freemarket

                      To Sergey,

                      I always use a4j:log on the page. The only thing that stands out in red and not always consistently is a oncomplete function error.

                      To Shimon,

                      I will try this tweak to the web.xml as well.

                      I have since moved to richfaces-3.20-SNAPSHOT and facelets-1.1.13 and have reduced
                      the incidence of JS errors under FF 2.0. IE6 is still a nightmare though IE7 is tolerable.

                      Regards,
                      Henry

                      • 8. Re: JS error: 'null' is null or is not an object
                        freemarket

                        Hi,

                        To follow up on this, here is the exact error from a4j:log:

                        error[9:56:51,392]: Error evaluate oncomplete function undefined


                        The context is a form which does an ajax submit via a4j:commandButton
                        which is supposed to return the record # of the new record created in the DB in a modalPanel popup.

                        The widget follows:

                        <h:panelGrid columns="2">
                         <a4j:commandButton id="save_rec" type="button" actionListener="#{dBCrudBean.actionSave}" value="Save"
                         oncomplete="javascript:Richfaces.showModalPanel('newRecPanel')" reRender="saveidtable">
                         <a4j:actionparam name="insertModeText" value="true" assignTo="#{dBCrudBean.insertModeText}"/>
                         </a4j:commandButton>
                         <a4j:commandButton id="clear_rec" type="reset" value="Reset"/>
                         </h:panelGrid>




                        The modalPanel code immediately follows this widget:

                        <ui:include src="panels/newrecResultsPanel.xhtml"/>

                        and here is that code:

                        <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                         xmlns:ui="http://java.sun.com/jsf/facelets"
                         xmlns:h="http://java.sun.com/jsf/html"
                         xmlns:f="http://java.sun.com/jsf/core"
                         xmlns:c="http://java.sun.com/jstl/core"
                         xmlns:rich="http://richfaces.org/rich"
                         xmlns:a4j="http://richfaces.org/a4j">
                        
                         <rich:modalPanel autosized="true" id="newrecResultsPanel">
                         <f:facet name="header">
                         <h:outputText value="New Record Info"/>
                         </f:facet>
                         <f:facet name="controls">
                         <h:graphicImage value="/images/close.gif" style="cursor:pointer" onclick="javascript:Richfaces.hideModalPanel('newRecResultsPanel')"/>
                         </f:facet>
                         <rich:dataTable value="#{dBCrudBean.myDataList}" var="sel" id="saveidtable">
                         <rich:column>
                         <f:facet name="header"><h:outputText value="New Request Id"/></f:facet>
                         <h:outputText value="#{sel.relrequest}"/>
                         </rich:column>
                         </rich:dataTable>
                         </rich:modalPanel>
                        </ui:composition>


                        The undefined oncomplete function still occurs if I place the ui:include for the modalpanel before the a4j:commandButton.

                        I have similar usage patterns elsewhere which successfully raise the modalPanel. Any tips?

                        Thanks,
                        Henry

                        • 9. Re: JS error: 'null' is null or is not an object
                          freemarket

                          Problem resolved - did not match id from showModalPanel() call to actual ui:included modalPanel.

                          Regards,
                          Henry