Announcement

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

  • rjlawre
    replied
    Same exact error here, using GWT 2.0.1 and the latest ee trial, but I'm not using a datasource at all, just invoking a Gwt Rpc service directly with

    Code:
    XXXService.Util.getInstance().doit(arg, callback)
    where arg is just an object with a list of other objects, all of which implement Serializable. When I print this with GWT.log I get the extra string "null" after the exception in the stack trace.

    It looks like (http://www.docjar.com/html/api/com/google/gwt/user/client/rpc/impl/SerializerBase.java.html) the "serialize" and later "check" method is getting a null value somehow. Not sure if this is a result of anything related to smartclient or not. I'm planning to experiment with this in another non-smartclient project today to see if I can recreate it there.

    Leave a comment:


  • jruiz
    replied
    Originally posted by jzaruba
    I'm not sure how this could possibly work without sending all the data (person, its boss, his boss, his boss, etc... whole db?) in one request. Otherwise your getBoss() call (which IMO happens on the client side) would either always return null OR it would have to make another (synchronous!) request to fetch the boss entity from the server.

    My understanding is that lazy many-to-one relations do not cope with the GWT concept.
    (I would be happy should anyone correct me on this.)
    I have the same problem and i cannot find a solution.
    Is there someone who has already implemented this kinf of datasource ?

    Leave a comment:


  • kvb
    replied
    Ok, so looking at the code of GWT itself, it looks like this error is thrown when I try to serialize a field that can't be serialized.

    The problem still is, I can't figure out what field of GWTCriterion causes this. Is there anyone out there with similar issues and (hopefully) a solution? :)

    Regards,

    Kees.

    Leave a comment:


  • kvb
    replied
    Can't get Criteria to work

    Hi all,

    First off: thanks so much for this discussion, it helped me a great lot with getting GWT-RPC datasources working.

    The only problem I still have left is fetching data using Criteria. I've looked at and tried the example from this thread with the GWTCriterion class, but I'm getting this error when I'm running it:

    Code:
    [ERROR] com.google.gwt.user.client.rpc.SerializationException
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.SerializerBase.check(SerializerBase.java:161)
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:145)
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:199)
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    [ERROR] 	at nl.kees.test.db.client.util.criteria.GWTCriterion_FieldSerializer.serialize(GWTCriterion_FieldSerializer.java:32)
    [ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [ERROR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [ERROR] 	at java.lang.reflect.Method.invoke(Method.java:592)
    [ERROR] 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    [ERROR] 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    [ERROR] 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    [ERROR] 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
    [ERROR] 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
    [ERROR] 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    [ERROR] 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    [ERROR] 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284)
    [ERROR] 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.SerializerBase$MethodMap$.serialize$(SerializerBase.java)
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:147)
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:199)
    [ERROR] 	at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    [ERROR] 	at nl.kees.test.db.client.admin.AdminDataService_Proxy.fetch(AdminDataService_Proxy.java:52)
    [ERROR] 	at nl.kees.test.db.client.util.DynamicDataSource.executeFetch(DynamicDataSource.java:90)
    [ERROR] 	at nl.kees.test.db.client.util.GwtRpcDataSource.transformRequest(GwtRpcDataSource.java:105)
    [ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [ERROR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [ERROR] 	at java.lang.reflect.Method.invoke(Method.java:592)
    [ERROR] 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    [ERROR] 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    [ERROR] 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    [ERROR] 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
    [ERROR] 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
    [ERROR] 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
    [ERROR] 	at java.lang.Thread.run(Thread.java:595)

    I read somewhere that since GWT 2.0 (which I'm using), the IsSerializable is re-introduced instead of the regular Serializable, which might make this old example to crash?

    Does anyone have this working (GWT-RPC fetching with Criteria) in GWT 2.0?

    Thanks for any help!

    Regards,

    Kees.

    Leave a comment:


  • harimohan.v@gmail.com
    replied
    Which one to use?

    Hi,

    Being new to smartGWT, I was exploring the datasource possibilities for the databinding. I have built the prototype on the lines of the code snippets picked from the <a href="http://www.smartclient.com/smartgwt/showcase/#main">showcase</a> which was using XML based datasources and static XML files.

    Coming to the real time databinding, I was exploring the advantages of using one of JSON/XML/GWTRPC Datasources over the other. For one, the GWT RPC implementation looks pretty neat given there are no "appends" as in building Strings and quite clearly pure OO. However, I don't want to consider that alone as a trait to choose the Datasource implementation.

    Could someone please suggest me which one to go with as in pros and cons of the implementations.



    Hari.

    Leave a comment:


  • KarnaTech
    replied
    is it possible to add new record at runtime

    Hi,
    I want to be able to update/ add data to a live grid. (that data item may or may not be visible in current view)
    Case 1:
    records 1-10 are visible from 50 records and 20 more records got added(or 20 got deleted) at the backend by another process.
    Case 2:
    records 1-10 are visible and 5th record got updated/deleted.

    How do i do this at runtime?(Assuming I somehow get an event for the same in GWT client code)

    Leave a comment:


  • Isomorphic
    replied
    @teisler You are about to head down a road of having to create a bunch of DTOs (data transfer objects) corresponding to each of your EJBs. If you'd like to avoid this work, take a look at the Pro and Enterprise versions, which avoid this work entirely, and offer dozens of other features you will likewise have to write yourself if you go with GWT-RPC.

    Leave a comment:


  • teisler
    replied
    How do you configure smartClient to work with a EJB Data Source?

    Good afternoon.

    I have an J2EE project which uses EJBs for the persistent layer.

    I'm trying to use the suggestions here to create a DataSource which would be used to a GWT-RPC Service which in turn calls an EJB SessionBean to return requested data.

    How do you configure the DataSource to work in this configuration?

    Specifically, how to you setup the project so that SmartClient knows how to find the source code for the Entity classes. They exist in a separate module (ejb module as opposed to the war module where smartclient lives) and likely exists in a package which does not extend the <smartclient-module/client> structure.

    When I try to build the project (I'm using netbeans with GWT4NB) I get the error:

    Code:
    Validating newly compiled units
         [ERROR] Errors in 'file:/<path to client/DataSource.java'
              [ERROR] Line 62: No source code is available for type <Entity>; did you forget to inherit a required module?
    I would appreciate your thoughts and comments.

    Regards,


    Troi


    Originally posted by mnenchev
    This is my entry point:
    public void onModuleLoad() {

    ListGridField rowNum = new ListGridField("id", "Id");
    rowNum.setWidth(65);
    rowNum.setCellFormatter(new CellFormatter() {
    public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
    return rowNum +"";
    }
    });

    ListGridField mail = new ListGridField("email", 100);

    final ListGrid listGrid = new ListGrid();
    rootPanel.add(listGrid);
    listGrid.setWidth100();
    listGrid.setHeight100();
    TestDataSource dataSource = new TestDataSource();
    listGrid.setAutoFetchData(true);
    listGrid.setDataSource(dataSource);
    listGrid.setFields(rowNum, mail);
    listGrid.setDataPageSize(10);
    listGrid.fetchData();
    listGrid.draw();
    }


    And this is what i have changed in the datasource:

    public TestDataSource() {
    DataSourceField field;
    field = new DataSourceIntegerField("id", "id");
    field.setPrimaryKey(true);
    field.setRequired(false);
    addField(field);
    field = new DataSourceTextField("mail", "mail");
    field.setRequired(true);
    addField(field);
    }

    @Override
    protected void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
    int startRow = request.getStartRow();
    int endRow = request.getEndRow();
    String sortBy = request.getSortBy();
    TestServiceAsync service = ServiceUtils.getTestServiceAsync();
    service.fetch(startRow, endRow, sortBy, new AsyncCallback<List<TestRecord>>() {
    public void onFailure(Throwable caught) {
    response.setStatus(RPCResponse.STATUS_FAILURE);
    processResponse(requestId, response);
    }

    public void onSuccess(List<TestRecord> result) {
    ListGridRecord[] list = new ListGridRecord[result.size()];
    for (int i = 0; i < list.length; i++) {
    ListGridRecord record = new ListGridRecord();
    copyValues(result.get(i), record);
    list[i] = record;
    }
    response.setData(list);
    processResponse(requestId, response);
    }
    });
    }

    The rpc is working fine(i tested it before).

    Leave a comment:


  • netname
    replied
    Using JSON for date fields

    This is regarding Mnenchev's suggestion of using JSON to avoid having to manually copy the data from your DTO to the ListRecord. His suggestion works fine but, for Date fields, I have a problem since JSON returns the date as a String and JSON Parse does not convert it to a Date Field. The question is where to fix this? Should I fix this case by case when using a Date Field in the execute Fetch method? Is there a way I can come up with a more generic solution and put it in GwtRPCDS when receiving a response? I would appreciate any suggestion on how to come up with a general solution

    On executeFetch I do:
    Code:
    ListGridRecord[] list = new ListGridRecord[size];
    if (size > 0) {
    	for (int i = 0; i < result.getRecords().size(); i++) {
    		if (i >= startIndex && i <= endIndex) {
    			final JSONObject obj = (JSONObject) JSONParser.parse(result.getRecords().get(i));
    			ListGridRecord record = new ListGridRecord(obj.getJavaScriptObject());
    			
    			list[i - startIndex] = record;
    		}
    	}
    }
    response.setData(list);
    On the server I do:

    Code:
    final JSON json = new JSON();
    
    json.addConvertor(MyDto.class, new JSONPojoConvertor(MyDto.class));
    String jsondto;
    
    jsondto = json.toJSON(new MyDto(batchId, batchDate, batchDesc, batchEntries, bankId));
    myList.add(jsondto);
    batchDate is returned as a String in executeFetch

    Leave a comment:


  • dimavin
    replied
    RE: JavaScriptException: (null) in DataSource.processResponse after switching to GWT2

    I have fixed the JavaScriptException: (null), reported earlier, by clearing Firefox Recent History, including cache.
    Thanks,
    Dmitriy

    Leave a comment:


  • sunnyl
    replied
    To clarify, I tested only using FF 3.5.6, and it worked as expected. Are you sure theres no references in the project to older GWT/SmartGWT versions perhaps? Can you post up somewhere the entire self contained project with the problem (ie, no references to JARs external to the project, keep it in web-inf/libs).


    dindeman: I think the GwtRpcDataSource is awesome. I'm planning to post up more real world examples of using it with SmartGWT components (esp combos and grids) later on.

    Leave a comment:


  • dimavin
    replied
    I have repeated my test from scratch and had the same error in Firefox. In IE it is working fine. I did the following:
    1. Downloaded the latest eclipse JDT: eclipse-java-galileo-SR1-win32.zip
    2. Installed Google plugin: http://dl.google.com/eclipse/plugin/3.5
    3. Imported the project, using new workspace.
    4. Started the app in Development mode using Run As -> Web Application.
    5. Used form to: put some value to Name field and press Save button.

    Leave a comment:


  • sunnyl
    replied
    Strange, I've just imported the project and its working fine.

    The only thing I needed to do was import the SmartGWT and GWT jars (I didn't have SMARTGWT_HOME set).

    Leave a comment:


  • dimavin
    replied
    Hi sunnyl,
    The full project is attached. I had to append .txt to the archive, as zip is not allowed as attachment.
    Attached Files

    Leave a comment:


  • sunnyl
    replied
    Could you post the complete project? (the code seems to differ in places to the original example). I had this error as well, but after a large code overhaul it went away and I was completely unsure why. I'm also on 2.0.


    Originally posted by dimavin
    Hi,

    My simple datasource test (based on alius code) stopped working after switching to GWT2.0, both for smartgwt 1.3 and 2.0.
    My client view contains a ListGrid and a DynamicForm, both bound to the same datasource.
    After adding a record via the form, SimpleGwtRPCDS.executeAdd() gets executed and the call back onSuccess() throws when calling
    processResponse(requestId, response);
    This is not happening if the ListGrid is removed or not connected to the datasource.

    Thanks,
    Dmitriy

    09:29:18.133 [ERROR] [ds0604] Uncaught exception escaped
    com.google.gwt.core.client.JavaScriptException: (null): null
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.data.DataSource.processResponse(DataSource.java)
    at my.client.SimpleGwtRPCDS$2.onSuccess(SimpleGwtRPCDS.java:122)
    at my.client.SimpleGwtRPCDS$2.onSuccess(SimpleGwtRPCDS.java:1)
    at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:216)

    Leave a comment:

Working...
X