开发者

GWT RCP ServiceEntryPointSpecifiedException

开发者 https://www.devze.com 2023-03-21 20:51 出处:网络
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: Servic

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.gw开发者_如何转开发t.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);
}


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消