GWT RCP ServiceEntryPointSpecifiedException - PullRequest
2 голосов
/ 21 июля 2011

Извините, я новичок в этой теме, но всегда получаю это исключение, когда хочу сделать вызов 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);
}

1 Ответ

4 голосов
/ 21 июля 2011

Добавить обратно в:

@RemoteServiceRelativePath("SpeicherService") 

Затем в вашем web.xml замените

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

с

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

Причина, по которой вам нужно это сделать, заключается в том, что вы используете: <module rename-to='kuss_projekt'> в вашем gwt.xml.

...