Java – GWT – unable to get type signature of class

I am developing an application GWT, which can search files on different servers I have my search code in the server package in the class named search To help the search find the server, I put the server location in a class called login, which is located in a shared package Login contains authentication objects that store information about a single server

The code for calling search is as follows:

SearchInterfaceAsync search = GWT.create(SearchInterface.class);
AsyncCallback<Void> callback = new AsyncCallback<Void>() {
    @Override
    public void onFailure(Throwable caught) {
        System.out.println("Error: " + caught.getMessage());
    }
    @Override
    public void onSuccess (Void results) {
        System.out.println("Success!");
    }
};

search.initialize(serverName,login,callback);
search.searchServers(search,varIoUsSearchParameters,callback);

When I run the program and try to search, the program prints an error: unable to get the type signature of the class [LCOM. Example. Test. Shared. Authentication

The authentication code is as follows:

public class Authentication implements Serializable {

    private static final long serialVersionUID = 5326256122438445301L;

    private String server;
    private String userName;
    private String password;

    public Authentication(String serverName){
        server = serverName;
    }

    public Authentication(String serverName,String user,String pass){
        server = serverName;
        userName = user;
        password = pass;
    }

    public String getServer(){
        return server;
    }

    public String getUserName(){
        return userName;
    }

    public String getpassword() {
        return password;
    }
}

I've tried to change the type declaration, add serialization, and switch to isserializable. It doesn't work!

Solution

You missed one: you must have a default (zero argument) constructor or you cannot create a new instance The deserialization process creates an object and then assigns fields

I believe you can protect this constructor so that developers won't accidentally use it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>