MyService:
---------------------
package client;
import java.io.FileNotFoundException;
import com.google.gwt.user.client.rpc.RemoteService;
public interface MyService extends RemoteService {
public String getResult () throws FileNotFoundException;
}
MyServiceImpl:
---------------------
package server;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import client.MyService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class MyServiceImpl extends RemoteServiceServlet implements
MyService {
public String getResult() throws FileNotFoundException {
File file = new File("asdf");
FileReader fr = new FileReader(file);
return "success!";
}
}
The error occurs at MyService:
[ERROR] Line 3: The import java.io.FileNotFoundException cannot be
resolved
Isn't it possible to throw exceptions through an RPC ?
Since for the most part the java.io package isn't part of the
emulation library, you can't really return a FileNotFoundException,
or for that matter use FileNotFoundException at all in your client code.
You'll need to wrap that FileNotFound exception on the server into a
custom exception that extends SerializableException, and return that.
-jason
Unknickable