I'm trying to serialize this object (OperatorDTO) so I can use RPC to send it from my server side to client. I've read other posts on this topic but I don't see why I'm doing anything diferent than other people.
When I'm running my project this error occurs
Compiling module edu.example.RPCExample
Computing all possible rebind results for 'edu.example.client.service.ExampleService'
Rebinding edu.example.client.service.ExampleService
Invoking generator com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator
Generating client proxy for remote service interface 'edu.example.client.service.ExampleService'
[ERROR] 'edu.example.client.models.OperatorDTO' has no instantiable subtypes
[ERROR] Errors in 'edu/example/client/service/ExampleServiceClientImpl.java'
[ERROR] Line 18: Failed to resolve 'edu.example.client.service.ExampleService' via deferred binding
Unification traversed 16362 fields and methods and 1526 types. 1494 are considered part of the current module and 1494 had all of their fields and methods traversed.
[ERROR] Compiler returned false
[WARN] recompile failed
[WARN] continuing to serve previous version
I don't understand why I get the error "OperatorDTO has no instantiable subtypes" when I've implemented io.serializable and only use basic data types in the class. Is there something that I'm using in the class that is not allowed to when serializing it?
package edu.example.client.models;
import java.io.Serializable;
public final class OperatorDTO implements Serializable
{
private static final long serialVersionUID = 1L;
private final int ID_MINIMUM_VALUE = 11;
private final int ID_MAXIMUM_VALUE = 99;
private final int RANK_MINIMUM_VALUE = -1;
private final int RANK_MAXIMUM_VALUE = 1;
private final int NAME_MINIMUM_LENGTH = 2;
private final int PASSWORD_MINIMUM_LENGTH = 6;
private final int NUMBER_OF_SPECIAL_CHARACTERS = 3;
private int oprID;
private String oprNavn;
private String ini;
private String cpr;
private String password;
private int rank;
public OperatorDTO(int oprID, String oprNavn, String ini, String cpr, String password, int rank) {
setOprID(oprID);
setName(oprNavn);
setIni(ini);
setCpr(cpr);
setPassword(password);
setRank(rank);
}
public OperatorDTO(int oprID, String oprNavn, String ini, String cpr, String password) {
setOprID(oprID);
setName(oprNavn);
setIni(ini);
setCpr(cpr);
setPassword(password);
}
public void setIni(String ini) {
this.ini = ini;
}
public String getIni() {
return this.ini;
}
public void setRank(int rank) {
if(rank >= RANK_MINIMUM_VALUE && rank <= RANK_MAXIMUM_VALUE)
this.rank = rank;kravende");
}
public int getRank() {
return this.rank;
}
public void setOprID(int oprID) {
if(oprID >= ID_MINIMUM_VALUE && oprID <= ID_MAXIMUM_VALUE)
this.oprID = oprID;
}
public int getOprID() {
return this.oprID;
}
public void setName(String name) {
if(name != null)
if(name.length() >= NAME_MINIMUM_LENGTH)
this.oprNavn = name;
}
public void setCpr(String cpr) {
this.cpr = cpr;
}
public void setPassword(String password) {
if(valPass(password))
this.password = password;
}
public String getName() {
return this.oprNavn;
}
public String getCpr() {
return this.cpr;
}
public String getPassword() {
return this.password;
}
private boolean valPass(String pass) {
if(pass.length() < PASSWORD_MINIMUM_LENGTH)
return false;
byte lowerCase = 0;
byte upperCase = 0;
byte digit = 0;
byte specialChar = 0;
char[] passChar = pass.toCharArray();
for (char c : passChar) {
if(Character.isLowerCase(c))
lowerCase = 1;
else if(Character.isUpperCase(c))
upperCase = 1;
else if(Character.isDigit(c))
digit = 1;
else if(c == 46 || c == 45 || c == 95 || c == 43 || c ==33 || c == 63 || c == 61)
specialChar = 1;
else
return false;
}
return (lowerCase + upperCase + digit + specialChar) >= NUMBER_OF_SPECIAL_CHARACTERS;
}
@Override
public String toString() {
return "OperatorDTO{" + "oprID=" + oprID + ", oprNavn=" + oprNavn + ", ini=" + ini + ", cpr=" + cpr + ", password=" + password + ", rank=" + rank + '}';
}
}
Thanks for any help in advance!
GWT requires a default constructor.
see http://www.gwtproject.org/doc/latest/tutorial/RPC.html#serialize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With