Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FactChart create exception

    Attempting to finally move from 12.1 to 13.0, I'm seeing the following exception when regressing code that uses the FacetChart.

    Uncaught Exception: Exception caught: (TypeError) : Cannot read properties of undefined (reading 'create')

    This occurs with the Simple Chart showcase code snippet as well:

    Code:
                // Creating data
                Record sprRec = new Record();
                sprRec.setAttribute("season", "Spring");
                sprRec.setAttribute("temp", "79");
                Record sumRec = new Record();
                sumRec.setAttribute("season", "Summer");
                sumRec.setAttribute("temp", "102");
                Record autRec = new Record();
                autRec.setAttribute("season", "Autumn");
                autRec.setAttribute("temp", "81");
                Record winRec = new Record();
                winRec.setAttribute("season", "Winter");
                winRec.setAttribute("temp", "59");
    
                // Creating chart
                FacetChart chart = new FacetChart();
                chart.setFacets(new Facet("season", "Season"));
                chart.setValueProperty("temp");
                chart.setData(new Record[]{sprRec, sumRec, autRec, winRec});
                chart.setTitle("Average temperature in Las Vegas");
    
                addMember(chart);

    v13.0p_2022-03-31/PowerEdition Deployment (built 2022-03-31)

    #2
    Hi eschwegs, do you have the charts module loaded? You should see ISC_Charts.js loaded from your server, and you can check whether the JavaScript expression "isc.FacetChart" is defined. If it's not, the module is not loaded.

    If that's not the problem, can you please show the complete client-side logs from your SmartGWT Developer Console?

    Comment


      #3
      It appears to be loaded:
      I had even sanity checked that the error occurs with both com.smartgwt.ChartsNoScript and com.smartgwt.Charts

      Evaluator: result of 'isc.FacetChart...' (0ms):
      {Class: "FacetChart",
      _isClassObject: true,
      ...
      === 2022-04-01 12:20:30,714 [9-83] INFO RequestContext - URL: '/barr/sc/modules-debug/ISC_Charts.js', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36': Safari with Accept-Encoding header
      === 2022-04-01 12:20:30,740 [9-83] INFO Compression - /barr/sc/modules-debug/ISC_Charts.js: 727.4k -> 126.1k

      The code snippet is being executed from a Button click handler. This is seen upon clicking it.

      Code:
      15:02:12.496:MUP2:WARN:Log:Uncaught Exception: Exception caught: (TypeError) : Cannot read properties of undefined (reading 'create')
      15:02:12.496:MUP2:WARN:Log:*************
      Stack Trace :
      15:02:12.498:MUP2:WARN:Log:Unknown.aMj_g$(Throwable.java:76)
      15:02:12.498:MUP2:WARN:Log:Unknown.JMj_g$(Exception.java:33)
      15:02:12.498:MUP2:WARN:Log:Unknown.RMj_g$(RuntimeException.java:33)
      15:02:12.498:MUP2:WARN:Log:Unknown.Zul_g$(UmbrellaException.java:65)
      15:02:12.498:MUP2:WARN:Log:Unknown.evl_g$(UmbrellaException.java:26)
      15:02:12.499:MUP2:WARN:Log:Unknown.bul_g$(HandlerManager.java:129)
      15:02:12.499:MUP2:WARN:Log:Unknown.Ic_g$(Widget.java:129)
      15:02:12.499:MUP2:WARN:Log:Unknown.anonymous(Canvas.java:9440)
      15:02:12.499:MUP2:WARN:Log:Unknown.aVj_g$(Impl.java:309)
      15:02:12.499:MUP2:WARN:Log:Unknown.dVj_g$(Impl.java:361)
      15:02:12.500:MUP2:WARN:Log:Unknown.anonymous(Impl.java:78)
      15:02:12.500:MUP2:WARN:Log:Unknown.anonymous(Canvas.java:9465)
      15:02:12.500:MUP2:WARN:Log:*************



      Last edited by eschwegs; 1 Apr 2022, 11:23.

      Comment


        #4
        Why do you say it appears to be loaded? The absence of ISC_Charts.js and that stack trace pretty definitively indicate it is not loaded. The crash you are seeing is a JS call to isc.FacetChart.create() and indicates that isc.FacetChart is not defined (as we recommended you check).

        Things to look at:
        1. you may not have the charts GWT module inherited
        2. you may not have run a GWT compile since updating your module includes (this copies files like ISC_Charts.js into your application)
        3. your bootstrap HTML file, if it manually loads the JS files, may be missing a line to load the charts module

        Comment


          #5
          Sorry, I went back and edited the 11:15 post when I found the ISC_Charts.js line in the server logs. The first quote of that post is the first few lines of the "isc.FacetChart" JS expression evaluation too. It dumped all the attributes of the class, a couple pages of values. From my understanding, that is all consistent with the <inherits name="com.smartgwt.ChartsNoScript"/> line in the <projectName>.gwt.xml file. I have also clean complied with both the ant gwtc target and eclipse's GWT compile menu options at various points switching back and forth from the NoScript version just to see if I could find clues. At no point was one or the other version of Charts no inherited. I'm not sure what you are seeing (other then the exception) to make you think the Chart module isn' t configured and being included. There is definitely something funny going on there however.

          Comment


            #6
            It looks like the debug version is configured in the .html bootstrap file: <script src="barr/sc/modules-debug/ISC_Charts.js"></script>

            Comment


              #7
              Ah yes, we see the evaluator output now.

              The stack trace shows a bunch of obfuscated GWT code and shows no frames of JS code from the underlying SmartClient runtime. That, coupled with the error message being about "create" (which is the JS method called to create a component) strongly suggests that the line of code that is crashing is isc.FacetChart.create(), and that it's crashing because isc.FacetChart is undefined.

              There is one way that isc.FacetChart could be both defined and undefined - maybe your code is somehow running before the charts module loads?

              You could check on the value of isc.FacetChart via JSNI right before you create your chart.

              You could also use the JS debugger to stop on errors and verify that what's crashing is the attempt to call isc.FacetChart.create().

              Comment


                #8
                >There is one way that isc.FacetChart could be both defined and undefined - maybe your code is somehow running before the charts module loads?
                >You could check on the value of isc.FacetChart via JSNI right before you create your chart.
                >You could also use the JS debugger to stop on errors and verify that what's crashing is the attempt to call isc.FacetChart.create().

                hmm. A little out of my comfort zone here, but it may be different then what is suspected.
                So Everything fully loads. I can evaluate "isc_FacetChart" in the developer console and see the entire class's content dump out. I click the button to execute the Chart code snippet and break on the line that adds the chart to the layout ("addMember(chart);"). Stepping over that specific line, with stop on exceptions set in Chrome brings me to ISC_Foundations.js line 960. I can't tell where in that line it has stopped on, but I've copied and pasted it bellow.

                Code:
                if(_1==(this.state==isc.StatefulCanvas.STATE_UP)){this.setState(_1?isc.StatefulCanvas.STATE_DISABLED:isc.StatefulCanvas.STATE_UP)}},isc.A.setVisibility=function isc_Scrollbar_setVisibility(_1,_2,_3,_4){this.invokeSuper(isc.Scrollbar,"setVisibility",_1,_2,_3,_4);if(this.isVisible())this.setThumb()},isc.A.parentVisibilityChanged=function isc_Scrollbar_parentVisibilityChanged(_1,_2,_3,_4){this.invokeSuper(isc.Scrollbar,"parentVisibilityChanged",_1,_2,_3,_4);if(this.isVisible())this.setThumb()},isc.A.drawPeers=function isc_Scrollbar_drawPeers(_1,_2,_3,_4){this.setThumb();this.invokeSuper(isc.Scrollbar,"drawPeers",_1,_2,_3,_4)},isc.A.resizePeersBy=function isc_Scrollbar_resizePeersBy(_1,_2){this.setThumb()},isc.A.makeThumb=function isc_Scrollbar_makeThumb(){if(!this.showThumb)return;var _1=this.scrollTarget==null?isc.Page.isRTL():this.scrollTarget.isRTL(),_2=isc.Browser.isTouch?8:0;var _3=this.vertical?this.vThumbClass:this.hThumbClass;this.thumb=_3.create({ID:this.getID()+"_thumb",scrollbar:this,state:this.state,visibility:this.visibility,autoApplyDownState:false,autoApplyOverState:false,width:this.vertical?this.getWidth():1,height:!this.vertical?this.getHeight():1,showTriggerArea:!!this.showThumbTriggerArea,triggerAreaLeft:this.vertical&&!_1?_2:0,triggerAreaRight:this.vertical&&_1?_2:0,triggerAreaTop:!this.vertical?_2:0,dragScrollDirection:this.vertical?isc.Canvas.VERTICAL:isc.Canvas.HORIZONTAL});if(this.thumb.showRollOver){this.allowThumbOverState=true}
                I'll look more into it Monday. Have a good weekend.

                Comment


                  #9
                  Hi Eric, we definitely didn't want to send you out of your comfort zone :) However, this now seems like conflicting information.

                  The previously shared stack trace shows only GWT-obfuscated method names and a crash before entering into any SmartClient JavaScript.

                  Your breakpoint shows a crash well into the framework - specifically, what is going on is creation of a Scrollbar (specifically the Thumb).

                  It's possible (maybe probable?) that at some point you got past the original error, which seemed to be the Charts module not loading, and now hit a new error.

                  Here's what we'd recommend next:

                  1. if you have a customized skin, temporarily replace it with a stock skin. The only reason we can think of for a crash in Scrollbar creation would be a customized skin.

                  2. temporarily turn off GWT obfuscation and run in SuperDevMode so we can see the trace more clearly

                  Comment


                    #10
                    Thanks for getting me pointed in the right direction. It worked out to be an issue with a customized skin. The Scrollbar [v|h]ThumClass properties were getting overridden to what looks to have been a class that no longer exists in present day code. For what ever reason, it only crashed in 13.0. thanks again.

                    Comment

                    Working...
                    X