What version of GWT are you using?
I seem to have the same problem with 1.6.1
I've tried both IsSerializable and Serializable, added the default
constructor and tried do simplify as much as I can my serializable
object. (though I didn't try <source path="server/model"/>, what is
that for and where does it go in the xml?), the gwt compiler just
doesn't add my class in the policy file.
@RemoteServiceRelativePath("greet")
public interface TechniciansOracleService extends RemoteService {
Response getTechnicians(Request search);
ArrayList<User> test();
public static class Util {
public static TechniciansOracleServiceAsync getInstance() {
TechniciansOracleServiceAsync instance =
(TechniciansOracleServiceAsync) GWT.create
(TechniciansOracleService.class);
return instance;
}
}
}
public interface TechniciansOracleServiceAsync {
void getTechnicians(Request search, AsyncCallback<Response>
callback);
}
public class TechnicianOracle extends SuggestOracle {
@Override
public void requestSuggestions(Request request, Callback callback) {
TechniciansOracleService.Util.getInstance().getTechnicians(request,
new TechnicianSuggestCallback(request,callback));
}
class TechnicianSuggestCallback implements AsyncCallback<Response> {
private Request request;
private Callback callback;
public TechnicianSuggestCallback(Request request, Callback
callback)
{
this.request = request;
this.callback = callback;
}
public void onFailure(Throwable error) {
callback.onSuggestionsReady(request, new Response());
}
public void onSuccess(Response response) {
callback.onSuggestionsReady(request, response);
}
}
}
public class TechniciansOracleImpl extends RemoteServiceServlet
implements TechniciansOracleService {
public Response getTechnicians(Request searchKeyword) {
ArrayList<User> technicians = new ArrayList<User>();
User u1 = new User(new Long(1), "asd", "asd", "asd");
User u2 = new User(new Long(1), "asd", "asd", "asd");
User u3 = new User(new Long(1), "asd", "asd", "asd");
User u4 = new User(new Long(1), "asd", "asd", "asd");
technicians.add(u1);
technicians.add(u2);
technicians.add(u3);
technicians.add(u4);
return new Response(technicians);
}
public ArrayList<User> test(){
return null;
}
}
public class User implements IsSerializable, Suggestion {
private String username, name, surname;
private Long id;
public String getDisplayString() {
return name + " " + surname + "; " + username;
}
public String getReplacementString() {
return name + " " + surname;
}
public User(Long id, String username, String name, String surname){
this.id = id;
this.username = username;
this.name = name;
this.surname = surname;
}
public User(){
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
On Mar 1, 12:02 pm, ben <[email protected]> wrote:
> Hi
>
> I have a model class Customer and this one has as a member variable an
> instance of the model class Address. Both of them satisfy the
> requirements for serializable Java beans (default constructor,
> serialVersionUID, implements java.io.Serializable). The path to the
> model classes are also included as source tag in the .gwt.xml property
> file: <source path="server/model"/>
>
> The Service method getCustomer() has as return value a Customer. When
> I execute a RPC-call an exception will occur: Type
> 'com.company.gwt.server.model.Address' was not included in the set of
> types which can be serialized by this SerializationPolicy.
>
> The Address Class is really not included in the SerializationPolicy.
> When I add a dummy service Method which include the Address Object as
> an argument or return value - also Address will be included in the
> Policy.
>
> How are the relevant Model classes elected for the
> SerializationPolicy? Doesn't the gwt compiler iterate over the whole
> object graph? How can I force the compiler to include also indirectly
> used model classes in the policy?
>
> Thanks in advance
> ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---