Announcement

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

  • aznan
    replied
    Too bad. And since I'm just a hobbyist, $700 is a little steep for something to put on my home server :P
    Thanks for the reply, though!
    /aznan

    Leave a comment:


  • marbot
    replied
    Originally posted by aznan
    Hi!
    I'm a total n00b in this area. I really like how easy it is to build advanced user interfaces using SmartGWT, but getting the data up has been a real hassle. Thanks to the ListGridTest I've finally gotten single class loading to work, but I have since spent an entire day trying to get a one-to-many relationship to work with no luck.

    Can anyone give me any pointers on how to accomplish this?
    Thanks!
    Hi aznan

    Well, this is where the actual GenericGwtRpcDataSource is limited. The SmartGWT EE Package offers ways to deal with one-to-many relationships without having to write code, but the GenericGwtRpcDataSource requests you to write your own code to deal with the Database. I cannot help you here. Have a look at the SmartGwt EE Package, maybe it fits your needs.

    marbot

    Leave a comment:


  • aznan
    replied
    Hi!
    I'm a total n00b in this area. I really like how easy it is to build advanced user interfaces using SmartGWT, but getting the data up has been a real hassle. Thanks to the ListGridTest I've finally gotten single class loading to work, but I have since spent an entire day trying to get a one-to-many relationship to work with no luck.

    Can anyone give me any pointers on how to accomplish this?
    Thanks!

    Leave a comment:


  • Principal Skiner
    replied
    This brings me to another problem.
    I am using custom criteria on my ListGrid.
    When I call :

    Code:
    grid.fetchData(customCriteria)
    criteria contains no keys or values that I defined. There is only "__gwt_ObjectId" as key mapped to some numeric value.
    Calling :
    Code:
    grid.getDataSource().fetchData(customCriteria)
    sends the custom criteria to the server side almost properly. I say almost because that "__gwt_ObjectId" is still present in criteria map together with my mappings.
    Any thoughts on this? Should that "__gwt_ObjectId" key be always present?

    Edit :
    Problem with fetch is solved. __gwt_ObjectId is still present in the map but causes no real problems. So I'll just leave it there :)
    Last edited by Principal Skiner; 2 Jul 2010, 12:35.

    Leave a comment:


  • Principal Skiner
    replied
    Problem with Seam solved.
    So I had a service interface like this :

    Code:
    public interface AlertWebService extends GenericGwtRpcService<AlertReport> {
    
      public AlertReport[] findAlerts(...)
    }
    Calling the findAlert() via RPC worked fine as before even after extending the GenericGwtRpcService interface. But calling the executeFetch caused problem on the server side. Seam was trying to find a component by the name "GenericGwtRpcService" but it should have been "AlertWebService".
    Reason :
    fetch method is located in GenericGwtRpcService interface so the name of the interface gets resolved to a Seam component's name.
    Solution (not the prettiest I admit) :
    copy the executeFetch method to AlertWebService. The method is duplicated in both interfaces but that's the best I could think of right now.
    After the workaround :
    Code:
    public interface AlertWebService extends GenericGwtRpcService<AlertReport> {
      public AlertReport[] findAlerts(...)
      List<AlertReport> fetch (...)
    }
    P.S.
    Seam users are probably familiar with the patch found here: http://virgo47.wordpress.com/2010/02...gwt-2-support/
    That is where component is sought after the name of service interface
    Last edited by Principal Skiner; 30 Jun 2010, 08:48.

    Leave a comment:


  • db75
    replied
    Originally posted by marbot
    Hi Denis

    Madamovic mentioned the following in his post:



    ...so maybe you could try a "try / catch" block? ...I suppose I was wrong with the Runtime-Exceptions (it's GWT after all, not plain Java), so maybe you need to alter the method signatur to throw a (plain old) java.lang.Exception?
    The fact of launching a Plain old java Exception make mandatory to add throws Exception on the signature of fetch method. So it is what I have done. Then when I execute this coding I've got the following error :

    Code:
    10:57:06.291 [ERROR] [helloworld] 10:57:06.309: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: 10:57:06.309: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:157)
        at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
        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 com.clog.gwt.client.GenericGwtRpcDataSource$1.onFailure(GenericGwtRpcDataSource.java:134)
        at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:218)
        at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
        at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:393)
        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:157)
        at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
        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.invokeNativeObject(ModuleSpace.java:264)
        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:188)
        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:157)
        at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
        at java.lang.Thread.run(Unknown Source)

    Leave a comment:


  • marbot
    replied
    Originally posted by Principal Skiner
    Thanks for the quick reply Marbot.
    Unfortunately the casting won't solve the problem. I have heartlessly removed all your generics thus made the GenericGwtRpcDataSource quite non-generic and the problem still persists. I'm 99% certain it is because of my service interface extends GenericGwtRpcService. I'll keep digging...
    ...Maybe it's too simple to work, but why don't we avoid the cast by making serviceAsync generic as well? (What I should have done from the beginning, when I think about it :-)) ...Does the following simple change work?

    Code:
    public abstract class GenericGwtRpcDataSource<D, R extends Record, SA extends GenericGwtRpcServiceAsync<D>>
    		extends GwtRpcDataSource {
    	
    	//private GenericGwtRpcServiceAsync<D> serviceAsync;
    	private SA serviceAsync;
    Note that I do not know Seam very well, just guessing... Avoiding using GenericGwtRpcServiceAsync in the first place might solve the casting problem...

    Leave a comment:


  • Principal Skiner
    replied
    Thanks for the quick reply Marbot.
    Unfortunately the casting won't solve the problem. I have heartlessly removed all your generics thus made the GenericGwtRpcDataSource quite non-generic and the problem still persists. I'm 99% certain it is because of my service interface extends GenericGwtRpcService. I'll keep digging...

    Leave a comment:


  • marbot
    replied
    Hi Denis

    Madamovic mentioned the following in his post:

    1. On the server, handle all exceptions and wrap them into Exception (java.lang.Exception), because only Exception can propagate properly to the client.
    ...so maybe you could try a "try / catch" block? ...I suppose I was wrong with the Runtime-Exceptions (it's GWT after all, not plain Java), so maybe you need to alter the method signatur to throw a (plain old) java.lang.Exception?

    ...sorry, I can't help you on that one at the moment, I've got too much to do and too little time lately... :-)

    please post any result you might get

    thanks
    marbot

    Leave a comment:


  • marbot
    replied
    Originally posted by Principal Skiner
    Hi guys.
    I ran into a problem with this implementation of data source when using GWT with Seam on the server side.
    The problem manifests itself on the server side when RPC is made. The logic on the server side tries to find Seam component using the name of the service interface. It tries to find "GenericGwtRpcDataSource" Seam component which does not exist. And it should not.
    I found a place where this can be solved but there is a problem.
    In GenericGwtRpcDataSource.executeFetch, the serviceAsync could be cast to its real type and therefore avoid the problem.
    I tried using Class.cast method but GWT 2.0.2 compiler cannot find it.
    Any suggestions?
    Hi Seymour

    I suppose GWT can't translate Class.cast to Javascript... I came across com.google.gwt.lang.Cast, maybe you could use it?

    see http://code.google.com/p/google-web-...c=svn7855&r=92

    cheers

    Leave a comment:


  • Principal Skiner
    replied
    Hi guys.
    I ran into a problem with this implementation of data source when using GWT with Seam on the server side.
    The problem manifests itself on the server side when RPC is made. The logic on the server side tries to find Seam component using the name of the service interface. It tries to find "GenericGwtRpcDataSource" Seam component which does not exist. And it should not.
    I found a place where this can be solved but there is a problem.
    In GenericGwtRpcDataSource.executeFetch, the serviceAsync could be cast to its real type and therefore avoid the problem.
    I tried using Class.cast method but GWT 2.0.2 compiler cannot find it.
    Any suggestions?

    Leave a comment:


  • db75
    replied
    And in developpement view (eclipse) I've got :
    Code:
    14:16:24.366 [ERROR] [helloworld] 14:16:24.347: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: 14:16:24.347: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:157)
        at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
        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 com.clog.gwt.client.GenericGwtRpcDataSource$1.onFailure(GenericGwtRpcDataSource.java:134)
        at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:218)
        at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
        at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:393)
        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:157)
        at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
        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.invokeNativeObject(ModuleSpace.java:264)
        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:188)
        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:157)
        at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
        at java.lang.Thread.run(Unknown Source)

    The fact is that the datasource which make the call to async service does'nt display any alert
    Code:
    @Override
    	public YourServiceAsync getServiceAsync() {
    		System.out.println("creation of YourService.class");
    		Window.alert("test");
    		//return new YourService();
    		
    		YourServiceAsync ysa = (YourServiceAsync)GWT.create(YourService.class);	
    		 AsyncCallback<String> callback = new AsyncCallback<String>() {
    		      public void onFailure(Throwable caught) {
    		    	  
    		        Window.alert(caught.toString());
    		      }
    
    		      public void onSuccess(String result) {
    		    	  
    		      }
    		 };
    		
    		ysa.setUserName("test", callback);
    		//ysa.password="test";		
    		return ysa;
    	}

    Leave a comment:


  • db75
    replied
    I agree however this kind of code generate a NPE sometimes :

    Code:
    public List<YourDataObject> fetch() {
    		System.out.println("fetch inside YourServiceImpl");
    		
    		items.clear();
    		
    		ViewDTO vd = new ViewDTO();
    
    		SAXReader reader = new SAXReader();
    		try{
    				Document document = WorkeyAPIUtils.getXMLInput(new APIClient("http://localhost:6060/api/View/1", user, "test").get(""));
    				Node fromNode = document.selectSingleNode("/w:view/@xlink:href");			
    				vd.setDesignerName(fromNode.getText());
    				
    				YourDataObject item4 = new YourDataObject();
    				item4.setId(5);
    				item4.setName(vd.getDesignerName());
    				item4.setFuck(vd.getWkyId());
    				items.add(item4);
    		}
    		catch (Exception e) {
    			throw new RuntimeException(e);
    		}
    		return items;
    	}
    The fact is I've got the following error which should'nt be in the log as a SEVERE error as it is intended and should be catch inside the async call in the datasource

    Code:
    29 juin 2010 12:06:27 com.google.appengine.tools.development.ApiProxyLocalImpl log
    SEVERE: [1277805987684000] javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
    com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.util.List com.clog.gwt.client.GenericGwtRpcDataSourceService.fetch()' threw an unexpected exception: java.lang.RuntimeException: java.lang.NullPointerException
    	at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
    	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
    	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:188)
    	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
    	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)

    Leave a comment:


  • marbot
    replied
    Hi db75

    I'm not sure it's what you're looking for, but consider this previous post from madamovic:

    http://forums.smartclient.com/showth...3616#post43616

    Besides, you do not need to change the fetch()-method signatur if you throw (unchecked) runtime-exceptions. The SmartGWT-Framework will propagate the exception to the client, and you should be able to get the exceptions in the onFailure()-method.

    marbot

    Leave a comment:


  • db75
    replied
    Hello,

    The fetch method of the service I'm implementing might throws various exceptions. However, the YourServiceImpl implements YourService which extends GenericGwtRpcDataSourceService<YourDataObject>. And the signature of GenericGwtRpcDataSourceService defines a fetch() method whithout any exception so the exception cannot be propagated to client datasource. Do you know a way to be able to throw exception with the fetch method ?

    Regards,
    Denis.

    Leave a comment:

Working...
X