我正在开发一个应用程序GWT,它可以搜索不同服务器上的文件.我在名为Search的类中的服务器包中有我的搜索代码.为了帮助搜索找到服务器,我将服务器位置放在名为Login的类中,该类位于共享包中.登录包含身份验证对象,用于存储单个服务器的信息.
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);
当我运行程序并尝试搜索时,程序打印错误:无法获取类[Lcom.example.test.shared.Authentication;的类型签名.
身份验证的代码如下:
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; } }
我试过更改类型声明,添加序列化,切换到IsSerializible,没有任何作用!