Go Back   SmartClient Forums > Smart GWT Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #261  
Old 11th Feb 2012, 04:40
Tasmit Tasmit is offline
Registered Developer
 
Join Date: Feb 2012
Posts: 10
Default

SmartGWT: 2.4 (simple, I'm just a hobbist).
Google Chrome: 17.0.963.46 (the latest version)

I have a ListGrid with custom DataSource (based on this topic).
On loading the page with this grid - it tries to fetch data.
It creates service, runs executeFetch and recieves an error.

Caught:
Code:
17:16:00.143 [INFO] [app] [ERROR] caught: com.google.gwt.user.client.rpc.StatusCodeException: 500 The call failed on the server; see server log for details
Code:
17:16:00.029 [ERROR] [app] 17:16:00.027:WARN:RPCManager:Error performing rpcRequest: error: FAILURE, response: {__gwt_ObjectId: 893, clientContext: Obj, status: -1, context: undef, startRow: 0, endRow: 0, totalRows: 0}
com.smartgwt.client.core.JsObject$SGWT_WARN: 17:16:00.027:WARN:RPCManager:Error performing rpcRequest: error: FAILURE, response: {__gwt_ObjectId: 893, clientContext: Obj, status: -1, context: undef, startRow: 0, endRow: 0, totalRows: 0}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
    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.invokeNativeVoid(ModuleSpace.java:289)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.data.DataSource.processResponse(DataSource.java)
    at ru.app.client.ui.data.datasources.ProjectInfoDS$1.onFailure(ProjectInfoDS.java:82)
    at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:237)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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.GeneratedMethodAccessor75.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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(Unknown Source)
ProjectInfo - just a simple object created for DataSource tesing (only long, String, Data). Service works with DB via ProjectInfoDao with HebarnateTemplate.
Tried to make it with gilead and without - doesn't matter.
Simple RPC service (just recieve a String from server) works fine.
"Extends", "implements", "web.xml", "appContext.xml" - are checked - everyting is done the same way as on simple (working) RPC service.

I saw, that in code examples from this topic, response have the following style:
response:
Code:
{clientContext: Obj, status: -1, context: undef, startRow: 0, endRow: 0, totalRows: 0}
And I have response:
Code:
{__gwt_ObjectId: 893, clientContext: Obj, status: -1, context: undef, startRow: 0, endRow: 0, totalRows: 0}
What is "__gwt_ObjectId: <id>"?
Can it be a reason of my errors?
How I can remove it from response?

Update:
I've tried to run dev mode on Firefox - it resolves __gwt_ObjectId problem, but the error remains the same :(:
Code:
22:22:47.712 [ERROR] [app] 22:22:47.707:WARN:RPCManager:Error performing rpcRequest: error: FAILURE, response: {clientContext: Obj, status: -1, context: undef, startRow: 0, endRow: 0, totalRows: 0}
com.smartgwt.client.core.JsObject$SGWT_WARN: 22:22:47.707:WARN:RPCManager:Error performing rpcRequest: error: FAILURE, response: {clientContext: Obj, status: -1, context: undef, startRow: 0, endRow: 0, totalRows: 0}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
    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.invokeNativeVoid(ModuleSpace.java:289)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.data.DataSource.processResponse(DataSource.java)
    at ru.app.client.ui.data.datasources.ProjectInfoDS$1.onFailure(ProjectInfoDS.java:82)
    at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:237)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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.GeneratedMethodAccessor36.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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(Unknown Source)

Last edited by Tasmit; 11th Feb 2012 at 09:27..
Reply With Quote
  #262  
Old 17th Feb 2012, 22:28
mljolje mljolje is offline
Registered Developer
 
Join Date: Aug 2009
Posts: 73
Default

Do not use google chrome for development, use firefox. Those strange ids are coming from google chrome in dev mode. In production it will be ok.
Br
Marije
Reply With Quote
  #263  
Old 29th Feb 2012, 19:38
Tasmit Tasmit is offline
Registered Developer
 
Join Date: Feb 2012
Posts: 10
Default

There were serialization problems due to Date's field (though it was java.util.Date, not java.sql.Date).

Has anybody bitblaster's filter's example?
Files on rapidshare have been expired and deleted :(.
I need to realize server-filtering via FilterBuilder on client-side and Hibernate on server-side, but a little bit confused with sending/transforming AdvancedCriterias.
Reply With Quote
  #264  
Old 16th Mar 2012, 02:07
aze_kool aze_kool is offline
Registered Developer
 
Join Date: Mar 2012
Posts: 5
Default

Hi guys I search a lot but can't find a understandable solution till yet.
Problem i have a Hierarchical object with associations.

Customer (firstname,lastname,age,gender ...)
-- Adress (street,housno,postcode,city,)(one to many )


I have a CustomerDataSource that fetch all the data related to customer in one request. so I get one Object CustomerData. This object holdes many objects of Class Adress inside it.

I donot want to use the nested Datasource for adress since i have the data.

How do I use this to bind it to a ListGrid and Form. so user can create a Customer with many adresses.



thanks in advance for a simple example.

Best Regards
Reply With Quote
  #265  
Old 16th Mar 2012, 02:10
aze_kool aze_kool is offline
Registered Developer
 
Join Date: Mar 2012
Posts: 5
Default

Has any body answers for the following question from earlierpost. a sample will be nice

Quote:
Originally Posted by fbrier
I love the Showcase and associated sample code. It has been very helpful. But now I am trying to use gwt-rpc to retrieve hierarchical objects and store them in DynamicForm(s).

Looking at Alius GwtRpcDataSource code and test cases, I did not see where it was performing a fetch/add/update on hierarchical object. The example shows data being copied to and from a ListGridRecord, but not something like a Record that contains other Record(s) and/or a ListGridRecord. Or does a GwtRpcDataSource create related VirtualDataSource(s) referenced by the forms? I am very confused.

Plus I want to create reusable form components for objects like Addresses and possibly use them in multiple forms. It would be kind of cool if you could create a FormItem derived class that was essentially an aggregate DynamicForm. So an Address POJO would populate an AddressForm. But I did not see methods that allowed a FormItem to nest sets of focus points, just one.

A typical example would be a PurchaseOrder POJO that contains billTo and shipTo properties of type Address, and an array of OrderItem instances.

I do not want a UI that has "Bill To - Address Line 1" as the title for the first field and "Bill To - Address Line 2" as the title for the second field, etc. I would rather have "Bill To" as the title on the far left and then have a reusable AddressForm on the right with "Line 1", "Line 2", "City", "State", and "ZIP" as the title. Ideally, it would be nice if City/State/ZIP could be on the same line.

And if there were multiple DynamicForms spread across multiple tabs, how does the ValuesManager come into play?

Are there any larger application examples of SmartGWT such as PetClinic application that might demonstrate some of these techniques?

Thank you for any help wrapping my head around this.
Reply With Quote
  #266  
Old 10th Apr 2012, 08:09
jlpuffe jlpuffe is offline
Registered Developer
 
Join Date: Mar 2012
Posts: 42
Default

This was an excellent example but I'm new to SmartGWT and am not sure how to implement a TreeGrid using your example. I would like to load on demand so when a folder is expanded I fetch the children at that time. I am able to successfully fetch the parent nodes but when I click to expand the folder I want to use a different datasource to fetch the children. I've tried looking at the information passed into the executeFetch() method to determine which parent node I"m on so I can fetch the children instead but apparently I"m not looking at the right variables. The parent nodes are "Manager" type nodes and the children nodes are "Training" nodes. So they aren't the same type of objects returned from the server.

I'm using SmartGWT 3.0 with FireFox 3.6.3

Basically what I've tried so far is as follows:
Code:
onModuleLoad() {

DataSource dataSource = ManagerDS.getInstance();
TreeGrid treeGrid = new TreeGrid();
treeGrid.setLoadDataOnDemand(true);
treeGrid.setWidth(500);
treeGrid.setHeight(400);
treeGrid.setAutoFetchData(true);
treeGrid.setDataSource(datasource);

TreeGridField field = new TreeGridField("manager", "Managers");
treeGrid.setFields(field);
treeGrid.fetchData();
treeGrid.draw();

}

public class ManagerDS extends GwtRPTDataSource {

private static ManagerDS instance = null;

public static ManagerDS getInstance() {
  if (instance == null) {
     instance = new ManagerDS();
  }
  return instance;
}


public ManagerDS() {

  DataSourceTextField username = new DataSourceTextField("username", "Username");
  username.setPrimaryKey(true);

 setFields(username);

}

@Override
protected void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
 
/// in this method I would like to determine which ManagerNode is selected 
// or is the first time called and we are getting all managers. If a  
// managerNode is selected and the tree is to be expanded I will call the 
// TrainingService.class instead of the ManagerService.class so I can fetch //all the training classes this manager has taken
 

   ManagerServiceAsync mgrService = GWT.create(ManagerService.class);
   mgrService.fetch(new AsyncCallback<List<ManagerRecord>> () {

          @Override
          public void onSuccess(List<ManagerRecord> 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);
            }

           @Override
           public void onFailure(Throwable caught) {
          }

   }

   private static Boolean copyValues(ListGridRecord from, ManagerRecord to) {
             to.setUsername(from.getAttributeAsString("username");
}

   private static Boolean copyValues(ManagerRecord from, ListGridRecord to) {
            to.setAttribute("username", from.getUsername());
}
}



public class ManagerRecord {

 private String username;

 public String getUsername() {
return username;
}
 public void setUsername(String username) {
    this.username = username;
}
}

public class TrainingRecord {
  private String trainingName;

  public String getTrainingName() {
       return trainingName;
   }
   public void setTrainingName(String trainingName) {
        this.trainingName = trainingName;
   }
}
Reply With Quote
  #267  
Old 10th Apr 2012, 11:17
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 37,456
Default

Since you're new, please note that we now strongly recommend against using GWT-RPC, for reasons listed in the FAQ.
Reply With Quote
  #268  
Old 11th Apr 2012, 04:15
jlpuffe jlpuffe is offline
Registered Developer
 
Join Date: Mar 2012
Posts: 42
Default

Quote:
Originally Posted by Isomorphic
Since you're new, please note that we now strongly recommend against using GWT-RPC, for reasons listed in the FAQ.
Thank you for your response. I'm new to smartgwt but the project I work on is already established and so I'm trying to add on to what is there. I have it mostly working except that I can't figure out how to get the parentId from DSRequest.

In my previous code example I modified the DataSource to add the parentId field. Yet when I try to get the attribute using the following code example nothing is returned for 'parentId'. On loadDataOnDemand how do I get the selected parent node's parentId passed into the executeFetch?

Code:
 the executeFetch(final String requestId, final DSRequest request, final DSResponse response) {

    String parentId = request.getCriteria().getAttribute("parentId");
}
Code:
onModuleLoad() {

DataSource dataSource = ManagerDS.getInstance();
TreeGrid treeGrid = new TreeGrid();
treeGrid.setLoadDataOnDemand(true);
treeGrid.setWidth(500);
treeGrid.setHeight(400);
treeGrid.setAutoFetchData(true);
treeGrid.setDataSource(datasource);

TreeGridField field = new TreeGridField("manager", "Managers");
treeGrid.setFields(field);
treeGrid.fetchData();
treeGrid.draw();

}

public class ManagerDS extends GwtRPTDataSource {

private static ManagerDS instance = null;

public static ManagerDS getInstance() {
  if (instance == null) {
     instance = new ManagerDS();
  }
  return instance;
}


public ManagerDS() {


  DataSourceTextField username = new DataSourceTextField("username", "Username");
  username.setPrimaryKey(true);
addField(username);

  DataSourceIntegerField id = new DataSourceIntegerField("parentId", "parentId");
 parentIdField.setRequired(true);
 parentIdField.setHidden(true);
  addField(parentIdField);

}

@Override
protected void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
 
/// in this method I would like to determine which ManagerNode is selected 
// or is the first time called and we are getting all managers. If a  
// managerNode is selected and the tree is to be expanded I will call the 
// TrainingService.class instead of the ManagerService.class so I can fetch //all the training classes this manager has taken
 
// I get null for parentId below
    String parentId = request.getCriteria().getAttribute("parentId");

   ManagerServiceAsync mgrService = GWT.create(ManagerService.class);
   mgrService.fetch(new AsyncCallback<List<ManagerRecord>> () {

          @Override
          public void onSuccess(List<ManagerRecord> 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);
            }

           @Override
           public void onFailure(Throwable caught) {
          }

   }


   private static Boolean copyValues(ListGridRecord from, ManagerRecord to) {
             to.setUsername(from.getAttributeAsString("username");
             to.setId(from.getAttributeAsInt("parentId");
}

   private static Boolean copyValues(ManagerRecord from, ListGridRecord to) {
            to.setAttribute("username", from.getUsername());
            to.setAttribute("parentId", from.getId());
}
}
Reply With Quote
  #269  
Old 11th Apr 2012, 06:29
jlpuffe jlpuffe is offline
Registered Developer
 
Join Date: Mar 2012
Posts: 42
Default

Quote:
Originally Posted by Isomorphic
Since you're new, please note that we now strongly recommend against using GWT-RPC, for reasons listed in the FAQ.
I retried using the following code. Whenever I expand a folder I would like the folder information so I can fetch the children correctly.

[Code]

onModuleLoad() {

DataSource dataSource = new DataSource() {
@Override
protected Object transformRequest(DSRequest dsRequest) {
Criteria criteria = dsRequest.getCriteria();
String parentId = criteria.getAttribute("parentId");
Window.alert("parentId="+parentId);
}

}

DataSourceTextField username = new DataSourceTextField("username", "Username");
username.setPrimaryKey(true);


DataSourceIntegerField id = new DataSourceIntegerField("parentId", "parentId");
parentIdField.setRequired(true);
parentIdField.setHidden(true);

dataSource.setFields(username, id);
dataSource.setDataURL("/context/my.jsp");
dataSource.setDataFormat(DSDataFormat.JSON);

TreeGrid treeGrid = new TreeGrid();
treeGrid.setLoadDataOnDemand(true);
treeGrid.setWidth(500);
treeGrid.setHeight(400);
treeGrid.setAutoFetchData(true);
treeGrid.setDataSource(datasource);

TreeGridField field = new TreeGridField("manager", "Managers");
treeGrid.setFields(field);
treeGrid.fetchData();
treeGrid.draw();

}
Reply With Quote
  #270  
Old 11th Apr 2012, 09:04
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 37,456
Default

Read the Tree Databinding overview - one obvious problem is that you have no foreignKey declaration at all.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved