Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java create(MyClass.class)给出了MyClass必须是类的错误_Java_Gwt - Fatal编程技术网

Java create(MyClass.class)给出了MyClass必须是类的错误

Java create(MyClass.class)给出了MyClass必须是类的错误,java,gwt,Java,Gwt,我正在尝试从EntryPoint类调用RemoteService。 但是,我在GWT.create()中得到了错误。我正在为我的服务传递客户端接口。我得到的错误是,它必须是一个类 19:private LoginServiceAsync LoginServiceAsync=GWT.create(LoginService.class) [错误]第19行:重新绑定结果'com.example.client.LoginService'必须是类 以下是我在客户端文件夹中登录服务的代码: package

我正在尝试从EntryPoint类调用RemoteService。 但是,我在GWT.create()中得到了错误。我正在为我的服务传递客户端接口。我得到的错误是,它必须是一个类

19:
private LoginServiceAsync LoginServiceAsync=GWT.create(LoginService.class)

[错误]第19行:重新绑定结果'com.example.client.LoginService'必须是类

以下是我在客户端文件夹中登录服务的代码:

package com.example.client;

import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("LoginService")
public interface LoginService  {
    boolean signUpUser(String name, String email, String password);
}

谁能告诉我我做错了什么?提前谢谢。

问题是我的接口没有扩展RemoteService

package com.example.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("LoginService")
public interface LoginService extends RemoteService {
    boolean signUpUser(String name, String email, String password);
}
解决了我的问题, 我还必须在LoginServiceAsync中更改这一点:

void signUpUser(String name, String email, String password,com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> arg4);
void signUpUser(字符串名称、字符串电子邮件、字符串密码、com.google.gwt.user.client.rpc.AsyncCallback arg4);

不知道为什么会这样,有人能解释一下吗?谢谢。

问题是我的接口没有扩展RemoteService

package com.example.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("LoginService")
public interface LoginService extends RemoteService {
    boolean signUpUser(String name, String email, String password);
}
解决了我的问题, 我还必须在LoginServiceAsync中更改这一点:

void signUpUser(String name, String email, String password,com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> arg4);
void signUpUser(字符串名称、字符串电子邮件、字符串密码、com.google.gwt.user.client.rpc.AsyncCallback arg4);
不知道为什么会这样,有人能解释一下吗?谢谢。

GWT.create(MyClass.class)
首先查找替换或生成规则。如果GWT没有找到规则,它将执行一个
newMyClass()

因为您没有扩展
RemoteService
,GWT找不到generate with规则,并尝试一个
new

这就是你犯这个错误的原因

GWT.create(MyClass.class)
首先查找替换或生成规则。如果GWT没有找到规则,它将执行一个
newMyClass()

因为您没有扩展
RemoteService
,GWT找不到generate with规则,并尝试一个
new


这就是你犯这个错误的原因

首先,您应该使用Maven/Gradle任务来生成异步接口,而不是使用自己的接口。第二,来自的答案解释了为什么必须扩展正确的接口。首先,应该使用Maven/Gradle任务生成异步接口,而不是使用自己的接口。第二,来自的答案解释了为什么必须扩展正确的界面。谢谢,谢谢你的解释!谢谢你的解释!