exception - GWT RCP ServiceEntryPointSpecifiedException

标签 exception gwt rpc

抱歉,我是这个主题的新手,但是当我想要进行 rpc 调用时,我总是遇到此异常:

原因:com.google.gwt.user.client.rpc.ServiceDefTarget$NoServiceEntryPointSpecifiedException:未指定服务实现 URL

我不知道为什么,因为我已经把它弄得像gwt教程了。

这是我的源代码:

web.xml:
<web-app>

<servlet>
    <servlet-name>SpeicherService</servlet-name>
    <servlet-class>de.fhdo.kuss.server.SpeicherServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>SpeicherService</servlet-name>
    <url-pattern>/SpeicherService</url-pattern>
</servlet-mapping>

<!-- Default page to serve -->
<welcome-file-list>
    <welcome-file>Kuss_Projekt.html</welcome-file>
</welcome-file-list>

</web-app>

-

Kuss_Projekt.gwt.xml:
<module rename-to='kuss_projekt'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />

<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<!--<inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!--<inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

<!-- Other module inherits -->

<!-- Specify the app entry point class. -->
<entry-point class='de.fhdo.kuss.client.Kuss_Projekt' />

<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />

 </module>

-

Speicherservice:
@RemoteServiceRelativePath("SpeicherService")
public interface SpeicherService extends RemoteService {

  String getName(String name);

  public static class Util {
    private static SpeicherServiceAsync instance;
    public static SpeicherServiceAsync getInstance(){
      if (instance == null) {
        instance = GWT.create(SpeicherService.class);
      }
    return instance;
   }
  }
}

-

SpeicherServiceAsync:
public interface SpeicherServiceAsync {

  void getName(String name, AsyncCallback<String> callback);

}

-

SpeicherServiceImpl:
public class SpeicherServiceImpl extends RemoteServiceServlet implements SpeicherService {

@Override
  public String getName(String name) {
    return("Server meldet sich " + name);
  }
}

-

Test():
public void test() {
AsyncCallback<String> callback = new AsyncCallback<String>() {

    @Override
    public void onFailure(Throwable caught) {
        // TODO Auto-generated method stub
    }

    @Override
    public void onSuccess(String result) {
        Window.alert(result);
    }
};

SpeicherService.Util.getInstance().getName("test",callback);
}

最佳答案

重新添加:

@RemoteServiceRelativePath("SpeicherService") 

然后在你的web.xml中替换

<url-pattern>/SpeicherService</url-pattern>

<url-pattern>/kuss_projekt/SpeicherService</url-pattern>

您需要这样做的原因是因为您正在使用:<module rename-to='kuss_projekt'>在您的 gwt.xml 中。

关于exception - GWT RCP ServiceEntryPointSpecifiedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6779410/

相关文章:

c++ - 在发生 bad_alloc 异常时从 std 容器中释放内存的策略

java - 在 GWT 异步调用中等待数据库结果

java - JsInterop - 获取数组中的值

java - 在 Apache Tomcat 上部署 GWT 应用程序

java - 如何将数据从一个java程序发送到另一个java程序

Java - 尝试写入文件 2 次或更多次时出现 BufferOverflowException

c++ - 禁用 MSVC 的异常

C++ 返回值与异常性能

java - App Engine + Google 文档

c - 在 RPC 代码中获取 memcheck 错误