Re: Can't get RPC example working (using GWT 1.5 and kitchenSink)

2008-10-23 Thread 전준희

I Love you guys too, as soon as got the exact same problem, the first
search result on Google was this thread, which solved the problem!@

On Sep 12, 9:49 am, vezir [EMAIL PROTECTED] wrote:
 I just luv u guyz thank u for the solution

 On Aug 29, 1:11 am, EJ Blom [EMAIL PROTECTED] wrote:

  Thanks! Removing theoverrideannotations did the trick (damn, i knew
  it was going to be easy).

  EJ

  On Aug 28, 10:53 pm, Jason Essington [EMAIL PROTECTED]
  wrote:

   the @overrideannotations need to go away
   and the onSuccess should be

   public void onSuccess(String result) rather than Object since you
   defined the callback asAsyncCallbackString

   see if those two things don't get you a little closer.

   -jason

   On Aug 28, 2008, at 1:52 PM, EJ Blom wrote:

Hi all,

It's a bit embarrassing, but the simplest RPC example (from
   http://www.thescreencast.com/2007/08/gwt-rpc-in-eclipse.html) will not
work in my environment. I created a new Eclipse Project and merged the
KitchenSink example in my own code (I really like the layout).
Everything worked fine, so I decided to move on to RPC.
All examples are copied from the screencast:

Service interface:

package client;

import com.google.gwt.user.client.rpc.RemoteService;

public interface MyService extends RemoteService{

   public String greeting(String helloTo);

}

Service implementation @ server side:

package server;

import client.MyService;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class MyServiceImpl extends RemoteServiceServlet implements
MyService {

  [EMAIL PROTECTED]
   public String greeting(String helloTo) {
           return Hello +helloTo+ from
+getServletContext().getServerInfo();
   }

}

My automanager.gwt.xml:

module

     inherits name='com.google.gwt.user.User'/
     entry-point class='client.automanager'/
     stylesheet src='automanager.css' /
     servlet path=/greeting class=server.MyServiceImpl /

/module

And the asynchronous interface:

package client;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;

public interface MyServiceAsync {

   public void greeting(String helloTo,AsyncCallbackString callback);

}

In automanager.java I added the following method which was linked to a
button click:

             public void remoteGreetingLabel(final Label label){
                     MyServiceAsync greetingService = (MyServiceAsync)
GWT.create(MyService.class);
                     ServiceDefTarget endpoint = 
(ServiceDefTarget)greetingService;
                     String moduleRelativeURL = 
GWT.getModuleBaseURL()+greeting;
                     endpoint.setServiceEntryPoint(moduleRelativeURL);

                     AsyncCallbackcallback = newAsyncCallback(){
                          [EMAIL PROTECTED]
                           public void onFailure(Throwable caught) {
                                   System.out.println(Error:  + 
caught.getMessage());
                           }

                          [EMAIL PROTECTED]
                           public void onSuccess(Object result) {
                                   label.setText((String)result);
                           }
                     };
                     greetingService.greeting(GWT-client, callback);
             }

By commenting theAsyncCallbackobject, everything runs fine (ofcourse
without the whole RPC thing), by uncommenting it I get the following
errors:

[TRACE] Compiling Java source files in module 'automanager'
[TRACE] Removing units with errors
[ERROR] Errors in 'file:/C:/workspace/automanager/src/client/
automanager.java'
[ERROR] Line 99: The method onFailure(Throwable) of type new
   AsyncCallback(){}mustoverridea superclass method
[ERROR] Line 105: The method onSuccess(Object) of type new
   AsyncCallback(){}mustoverridea superclass method
[TRACE] Finding entry point classes
[ERROR] Unable to find type 'client.automanager'
[ERROR] Hint: Previous compiler errors may have made this type
unavailable
[ERROR] Failure to load module 'automanager'

Anyone?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Can't get RPC example working (using GWT 1.5 and kitchenSink)

2008-08-29 Thread EJ Blom

Thanks! Removing the override annotations did the trick (damn, i knew
it was going to be easy).

EJ

On Aug 28, 10:53 pm, Jason Essington [EMAIL PROTECTED]
wrote:
 the @override annotations need to go away
 and the onSuccess should be

 public void onSuccess(String result) rather than Object since you
 defined the callback as AsyncCallbackString

 see if those two things don't get you a little closer.

 -jason

 On Aug 28, 2008, at 1:52 PM, EJ Blom wrote:



  Hi all,

  It's a bit embarrassing, but the simplest RPC example (from
 http://www.thescreencast.com/2007/08/gwt-rpc-in-eclipse.html) will not
  work in my environment. I created a new Eclipse Project and merged the
  KitchenSink example in my own code (I really like the layout).
  Everything worked fine, so I decided to move on to RPC.
  All examples are copied from the screencast:

  Service interface:

  package client;

  import com.google.gwt.user.client.rpc.RemoteService;

  public interface MyService extends RemoteService{

 public String greeting(String helloTo);

  }

  Service implementation @ server side:

  package server;

  import client.MyService;

  import com.google.gwt.user.server.rpc.RemoteServiceServlet;

  public class MyServiceImpl extends RemoteServiceServlet implements
  MyService {

 @Override
 public String greeting(String helloTo) {
 return Hello +helloTo+ from
  +getServletContext().getServerInfo();
 }

  }

  My automanager.gwt.xml:

  module

   inherits name='com.google.gwt.user.User'/
   entry-point class='client.automanager'/
   stylesheet src='automanager.css' /
   servlet path=/greeting class=server.MyServiceImpl /

  /module

  And the asynchronous interface:

  package client;

  import com.google.gwt.user.client.rpc.AsyncCallback;
  import com.google.gwt.user.client.rpc.RemoteService;

  public interface MyServiceAsync {

 public void greeting(String helloTo, AsyncCallbackString callback);

  }

  In automanager.java I added the following method which was linked to a
  button click:

   public void remoteGreetingLabel(final Label label){
   MyServiceAsync greetingService = (MyServiceAsync)
  GWT.create(MyService.class);
   ServiceDefTarget endpoint = 
  (ServiceDefTarget)greetingService;
   String moduleRelativeURL = 
  GWT.getModuleBaseURL()+greeting;
   endpoint.setServiceEntryPoint(moduleRelativeURL);

   AsyncCallback callback = new AsyncCallback(){
 @Override
 public void onFailure(Throwable caught) {
 System.out.println(Error:  + 
  caught.getMessage());
 }

 @Override
 public void onSuccess(Object result) {
 label.setText((String)result);
 }
   };
   greetingService.greeting(GWT-client, callback);
   }

  By commenting the AsyncCallback object, everything runs fine (ofcourse
  without the whole RPC thing), by uncommenting it I get the following
  errors:

  [TRACE] Compiling Java source files in module 'automanager'
  [TRACE] Removing units with errors
  [ERROR] Errors in 'file:/C:/workspace/automanager/src/client/
  automanager.java'
  [ERROR] Line 99: The method onFailure(Throwable) of type new
  AsyncCallback(){} must override a superclass method
  [ERROR] Line 105: The method onSuccess(Object) of type new
  AsyncCallback(){} must override a superclass method
  [TRACE] Finding entry point classes
  [ERROR] Unable to find type 'client.automanager'
  [ERROR] Hint: Previous compiler errors may have made this type
  unavailable
  [ERROR] Failure to load module 'automanager'

  Anyone?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---