GWT RCP ServiceEntryPointSpecifiedException

发布于 2024-11-25 09:06:02 字数 3075 浏览 0 评论 0原文

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

Caused by: com.google.gwt.user.client.rpc.ServiceDefTarget$NoServiceEntryPointSpecifiedException: Serviceimplementation URL not specified

I don'不知道为什么,因为我已经把它做得像 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);
}

Sry I am newbie to this Topic, but I always get this Exception when I want to make a rpc call:

Caused by: com.google.gwt.user.client.rpc.ServiceDefTarget$NoServiceEntryPointSpecifiedException: Service implementation URL not specified

I don't know why, because I have make it like the gwt Tutorial.

Thats my source code:

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);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

但可醉心 2024-12-02 09:06:02

添加回:

@RemoteServiceRelativePath("SpeicherService") 

然后在您的 web.xml 中替换

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

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

您需要这样做的原因是因为您在 gwt.xml 中使用:

Add back in:

@RemoteServiceRelativePath("SpeicherService") 

Then in your web.xml replace

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

with

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

The reason you need to do that is because you are using: <module rename-to='kuss_projekt'> in your gwt.xml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文