我想熟悉使用GWT API来创建基于Web的应用程序。我一直在关注GWT的一些教程,并且还没有能够进行RPC调用。从广泛的角度来看问题,我的目标是做一个服务器调用来运行一系列我知道工作的数据库测试(我测试过这个代码)。GWT rpc失败 - 基地址不是我所期望的
---编辑---
我觉得这里的问题是,资源正在寻找在这里: /MatesWeb/org.matesweb.Main/peopleService
时,我认为这应该看这里: /MatesWeb/peopleService
--- END_EDIT ---
这里是信息和代码,我觉得是相关的:
个- 使用NetBeans的
- 错误,我得到的是“/MatesWeb/org.matesweb.Main/PeopleService - 描述 - 请求的资源不可用。”
-GWT.getModuleBaseURL()返回:8080/MatesWeb/org.matesweb.Main/
在浏览器-URL是:8080/MatesWeb/
从web.xml文件
<servlet>
<servlet-name>peopleService</servlet-name>
<servlet-class>org.matesweb.server.PeopleServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>peopleService</servlet-name>
<url-pattern>/peopleService</url-pattern>
</servlet-mapping>
From PeopleService Service package org.matesweb.client;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("PeopleService")
public interface PeopleService extends RemoteService {
String[] saveGetPerson(String[] persInfo);
int runTests();
}
从PeopleServiceImpl 包org.matesweb.server;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import org.matesweb.client.PeopleService;
import org.matesweb.server.tests.DbTest;
class PeopleServiceImpl extends RemoteServiceServlet implements PeopleService {
@Override
public String[] saveGetPerson(String[] persInfo) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int runTests()
{
int retInt;
DbTest dbTest = new DbTest();
retInt = dbTest.runTests();
return retInt;
}
}
从PeopleServiceAsync
package org.matesweb.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface PeopleServiceAsync
{
void saveGetPerson(String[] persInfo, AsyncCallback<String[]> persInformation);
void runTests(AsyncCallback<Integer> retInt);
}
的任何想法什么怎么回事?
干杯, 尼克
我试着改变它,它似乎没有任何帮助。我认为这里的问题是这里的资源正在寻找: /MatesWeb/org.matesweb.Main/peopleService 当我认为它应该在这里寻找: /MatesWeb/peopleService – nmio