Announcement

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

    Error when I try to load a DS with records that have a java object in Attribute

    When I try to insert a record with an attribute of type "JavaObject" in DataSource, I have an exception that I describe below (not very informative):

    Code:
    YourClientOnlyDataSource.getInstance().addData(selectedRecord,new DSCallback() {
    	public void execute(DSResponse response,
    		Object rawData, DSRequest request) {
    		system.out.println("Not up here!")
    }
    });
    However, it works when I add the record to the RPC DataSource with the following statement:
    Code:
    List<ListGridRecord> records = new ArrayList<ListGridRecord>();
    for (YourDataObject data : result) {
    	ListGridRecord newRec = new ListGridRecord();
    	copyValues(data, newRec);
    	newRec.setAttribute("Object", data);
    	records.add(newRec);
    }
    response.setData(records.toArray(new Record[records.size()]));
    processResponse(requestId, response);
    You should note that this object then I want it back:
    Code:
    YourDataObject myObject = (YourDataObject) selectedRecord.getAttributeAsObject("Object");
    I wonder if you can help me. Thanks!

    ------------------------------------------------------------------------------------------

    1. the SmartGWT or SmartClient version and browser version(s) involved;
    SmartGWT-3.0, Firefox and Safari

    2. for a server-side problem, nothing to see

    3. for a client-side problem, the contents of the Developer Console:
    Code:
    15:14:08.252 [ERROR] [dsrpc] Uncaught exception escaped
    com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
        at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
        at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Thread.java:722)
    Caused by: com.google.gwt.core.client.JavaScriptException: (null): null
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.smartgwt.client.data.DataSource.addData(DataSource.java)
        at org.coag.client.dsrpc.addRecordToDS(dsrpc.java:284)
        at org.coag.client.dsrpc.access$0(dsrpc.java:282)
        at org.coag.client.dsrpc$9.onClick(dsrpc.java:236)
        at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:96)
        at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
        at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
        at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
        at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
        at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
        at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
        at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Thread.java:722)
    4. JavaScript error: "Caused by: com.google.gwt.core.client.JavaScriptException: (null): null"

    5. sample code and sketch: Attached
    Attached Files

    #2
    For a JavaScript error, capture the Developer Console contents *in compiled mode* on specific browsers to get a stack trace. See the FAQ for details.

    It looks like you've posted a bunch of code involving GWT-RPC. If you think this is a bug that doesn't involve GWT-RPC, please post a minimal test case.

    Comment


      #3
      I'm sorry for not providing all the information needed. Only in debug mode fails!

      It has nothing to do with GWT-RPC. Only I indicated to illustrate a case where it works properly (in compiled and debug mode)
      Code:
      //com.smartgwt.client.data.DataSource
      List<R> records = new ArrayList<R>();
      YourDataObject yourData = new YourDataObject();
      ListGridRecord myRecord = new ListGridRecord();
      myRecord.setAttribute("name", yourData.getName());
      myRecord.setAttribute("location", yourData.getLocation());
      myRecord.setAttribute("Object", yourData);
      
      records.add(myRecord);
      response.setData(records.toArray(new Record[records.size()]));
      processResponse(requestId, response);
      I simplify everything in one file to reproduce the problem. I try to capture with smart console but I can not capture anything (not in debug mode or compiled mode).

      All code (much shorter) involved in the problem, is attached. For me, it fails in debug mode is a big problem

      Thanks!
      Attached Files

      Comment

      Working...
      X