Announcement

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

    Problems after upgrade smargwt 4.0p to 5.1p

    Hello,

    I have some issues after upgrading our application base on :
    - tomcat7, jdk 7, gwt 2.6.1, smartgwt 4.0p lgpl
    to
    - tomcat8, jdk 8 (no java 8 syntaxe in code), gwt 2.7.0, smartgwt 5.1p lgpl

    Almost parts of the application work well but there is a recurrent issue on function addData() of Datasource class,
    when we add a record containing a field of type DataSourceBinaryField, the following JS error happened :

    Code:
    com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'getWrapped_1_g$' of undefined
        at toString_35_g$(muse-0.js@46:149585)
        at toString(muse-0.js@15:345)
        at isc_isA_Date(http://localhost:8080/muse/muse/sc/modules/ISC_Core.js?isc_version=10.1p.js@10:140)
        at isc_DataSource_serializeFields(http://localhost:8080/muse/muse/sc/modules/ISC_DataBinding.js?isc_version=10.1p.js@222:525)
        at isc_DataSource_getServiceInputs(http://localhost:8080/muse/muse/sc/modules/ISC_DataBinding.js?isc_version=10.1p.js@25:551)
        at isc_DataSource_sendDSRequest(http://localhost:8080/muse/muse/sc/modules/ISC_DataBinding.js?isc_version=10.1p.js@14:792)
        at isc_DataSource_performDSOperation(http://localhost:8080/muse/muse/sc/modules/ISC_DataBinding.js?isc_version=10.1p.js@13:765)
        at isc_DataSource_addData(http://localhost:8080/muse/muse/sc/modules/ISC_DataBinding.js?isc_version=10.1p.js@6:752)
        at addData_0_g$(muse-0.js@13:19687)
        at addData_13_g$(muse-0.js@24:102218)
        at addNewEmptyRecord_2_g$(muse-0.js@8:102257)
        at initNewExperience_0_g$(muse-0.js@51:80691)
        at onClick_141_g$(muse-0.js@25:82036)
        at dispatch_242_g$(muse-0.js@16:371077)
        at dispatch_241_g$(muse-0.js@8:371073)
        at dispatch_2_g$(muse-0.js@8:2190)
        at dispatchEvent_2_g$(muse-0.js@14:240612)
        at doFire_1_g$(muse-0.js@9:240710)
        at fireEvent_7_g$(muse-0.js@8:240783)
        at fireEvent_6_g$(muse-0.js@24:240561)
        at fireEvent_1_g$(muse-0.js@30:3135)
        at anonymous(muse-0.js@16:10539)
        at apply_63_g$(muse-0.js@28:216616)
        at entry0_0_g$(muse-0.js@16:216672)
        at anonymous(muse-0.js@14:216652)
        at obj_0_g$.addProperties.click(muse-0.js@22:10549)
        at isc_StatefulCanvas_handleActivate(http://localhost:8080/muse/muse/sc/modules/ISC_Foundation.js?isc_version=10.1p.js@108:208)
        at isc_StatefulCanvas_handleClick(http://localhost:8080/muse/muse/sc/modules/ISC_Foundation.js?isc_version=10.1p.js@13:209)
        at isc_c_EventHandler_bubbleEvent(http://localhost:8080/muse/muse/sc/modules/ISC_Core.js?isc_version=10.1p.js@89:1629)
        at isc_c_EventHandler_handleClick(http://localhost:8080/muse/muse/sc/modules/ISC_Core.js?isc_version=10.1p.js@50:1489)
        at isc_c_EventHandler__handleMouseUp(http://localhost:8080/muse/muse/sc/modules/ISC_Core.js?isc_version=10.1p.js@11:1474)
        at isc_c_EventHandler_handleMouseUp(http://localhost:8080/muse/muse/sc/modules/ISC_Core.js?isc_version=10.1p.js@57:1465)
        at isc_c_EventHandler_dispatch(http://localhost:8080/muse/muse/sc/modules/ISC_Core.js?isc_version=10.1p.js@108:1707)
        at eval(eval at isc__makeFunction (http://localhost:8080/muse/muse/sc/modules/ISC_Core.js?isc_version=10.1p.js@122:54)
    If we comments the line matching to the set of object in record the error disappears, also work with
    Code:
    record.setAttribute('object_key', (Object) null)
    A working patch will be to add in each DataSource a Map to store all objects, but I hope it will be our last solution.

    Thanks for your help.





    #2
    This looks like it's some kind of bogus error, which might disappear if you clear browser cache, restart your IDE, clear the GWT unitcache or take similar steps to make sure nothing is left over from old versions.

    If that's not fixing the problem:

    1. See if the error is in fact specific to the GWT version by trying 2.6.1 with the new SmartGWT or vice versa
    2. See if you've actually got a toString override somewhere in your application, especially if you are providing a subclass of Date in your Records

    Comment


      #3
      Thanks for your anwser.
      The clear, restart and co was already before my ask.

      Downgrade to GWT 2.6.1 fix the issue...

      But I also checked if we have overriden a toString method or have a date, but no.
      The problem happened with basic Proxy object store as binary object in datasource (no reference to a date) like this :

      Code:
      @ProxyFor(value = NiveauLangue.class, locator = NiveauLangueLocator.class)
      public interface NiveauLangueProxy extends ProxyWithId, EntityProxy, ProxyWithCode, SortedProxy {
      
          @Override
          public Long getId();
      
          public void setId(Long id);
      
          @Override
          public String getCode();
      
          @Override
          public void setCode(String code);
      
          @Override
          public Long getSort();
      
          @Override
          public void setSort(Long sort);
      }
      Code:
              dataSource = new DataSource();
              dataSource.setID(siName+"_"+new Date().getTime()+"_DS");
      
              DataSourceTextField idField = new DataSourceTextField(KEY_ID);
              idField.setPrimaryKey(true);
              DataSourceTextField value = new DataSourceTextField(KEY_LABEL);
              DataSourceBinaryField object = new DataSourceBinaryField(KEY_OBJECT);
              DataSourceTextField sortField = new DataSourceTextField(KEY_SORT);
      
              dataSource.setFields(idField, value, sortField, object);
              dataSource.setClientOnly(true);
      
              ......
              ......
              ......
             
      
              Record record = new Record();
              record.setAttribute(KEY_ID, getId(bean));    ------------------- > // bean is a instance of NiveauLangueProxy
              record.setAttribute(KEY_LABEL, getLabel(bean));
              record.setAttribute(KEY_SORT,  getSort(bean, i++));
              record.setAttributeAsJavaObject(KEY_OBJECT, bean);
             
             dataSource.addData(record);    -------------->   // error here
      I don't understand why with gwt 2.7.0, a date type check is done and failed.

      Comment


        #4
        OK, what appears to be happening here is:

        1. you're passing this special proxy object to addData() such that it's going to be sent to the server

        2. as part of serializing the data, SmartGWT checks whether it might be a Date. This is part of a series of checks to figure out the type of the data so we know how to serialize it

        3. GWT seemingly has a bug where if toString() is called on a Proxy object from JavaScript, it just crashes

        You could try to create an isolated test case for this and report it as a bug for GWT.

        Bigger picture though, what were you hoping would happen when you try to send an EntityProxy through SmartGWT's XML serialization? Did that actually work in the past?

        Comment


          #5
          We use only UI components of smargwt, we don't make call to our server wiih DSResquest.

          The working worflow before upgrade gwt/smartgwt was :
          - Client UI is rendering, with a SelectItem (a datasource is set on it)
          - Make a call to server with a gwt RequestFectory to return a list of NiveauLangueProxy.
          - Fill one Record by element in returned list and add it to the datasource of the selectitem (now, here a error occured)
          after drawn
          - The user could make a choice in the selectItem and we get the NiveauLangueProxy store in datasource, and reuse it later for a new call to server like a save or a search.

          Below is the generated javascript whose created the error :

          Code:
          (TypeError) : Cannot read property 'getWrapped_1_g$' of undefined ===> this.this$01_855_g$.getWrapped_1_g$()
          
          _.toString$ = function toString_54_g$(){
            return dynamicCast_0_g$(this.this$01_855_g$.getWrapped_1_g$(), 1489).toString$();
          }
          
          function NiveauLangueProxyAutoBean_com_google_web_bindery_requestfactory_shared_impl_EntityProxyCategory_com_google_web_bindery_requestfactory_shared_impl_ValueProxyCategory_com_google_web_bindery_requestfactory_shared_impl_BaseProxyCategory$1_1_g$(this$0_0_g$){
            $clinit_NiveauLangueProxyAutoBean_com_google_web_bindery_requestfactory_shared_impl_EntityProxyCategory_com_google_web_bindery_requestfactory_shared_impl_ValueProxyCategory_com_google_web_bindery_requestfactory_shared_impl_BaseProxyCategory$1_0_g$();
            this.this$01_855_g$ = this$0_0_g$;
            Object_1_g$.call(this);
            this.$init_5994_g$();
          }

          Comment


            #6
            It looks like requests for clientOnly DataSources are doing some preparation of data for transmission to a server, which actually doesn't need to be done. So we can get a slight optimization by avoiding this, and this will happen to avoid triggering the GWT bug you've discovered - for this codepath. We'd still advise you to file a bug with Google since this same crashing toString() method could be hit by lots of other code.

            Comment


              #7
              Thanks for your help, I will report to Gwt this issue.

              A last question, there is a new maven repository for smartgwt 5.1 and higher ? Currently, I must put 5.1 jar manualy to my project.


              Comment


                #8
                We're not sure where you're looking, but instructions for using Maven with SmartGWT are here.

                Comment


                  #9
                  We have applied the change in our code that avoids the preparation steps not needed in clientOnly fetches, so the GWT bug should not trigger. You will find this change applied since the nightly build generated tonight. Could you please re-test your code with this latest version of SGWT, and check if this fixes your problem?

                  Comment

                  Working...
                  X