Failed to resolve 'client.DataService' via deferred binding

443 views
Skip to first unread message

pasi

unread,
May 20, 2009, 6:44:15 AM5/20/09
to Google Web Toolkit
Hi,

I am building applications using GWT 1.5.3 on JDK 1.5.0_09.

While trying to build an application regarding GWT RPC, I got stucked
with the following compilation error..

E:\GWT_WORKSPACE\HelloServlet>HelloServlet-compile
*************************************************************************************************************
Compiling module HelloServlet
Scanning for additional dependencies: file:/E:/GWT_WORKSPACE/
HelloServlet/src/client/HelloServlet.java
Computing all possible rebind results for 'client.DataService'
Rebinding client.DataService
Invoking <generate-with
class='com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator'/
>
Generating client proxy for remote service interface
'client.DataService'
Checking the synchronous interface 'client.DataService'
against its asynchronous version 'client.DataServiceAsync'
[ERROR] The asynchronous version of
client.DataService has more methods than the synchronous version
A valid definition for the asynchronous version of
interface 'client.DataService' would be:

[ERROR]
package client;

public interface DataServiceAsync {
void reverseString(client.TestString stringToReverse,
com.google.gwt.user.client.rpc.AsyncCallback<java.lang.String> arg2);
}
[ERROR] Errors in 'file:/E:/GWT_WORKSPACE/HelloServlet/src/client/
HelloServlet.java'
[ERROR] Line 26: Failed to resolve 'client.DataService' via
deferred binding
[ERROR] Cannot proceed due to previous errors
[ERROR] Build failed
********************************************************************************************************************
------------------------------- The source code follows
------------------------------

DataService.java
------------------------
package client;
import com.google.gwt.user.client.rpc.RemoteService;

public interface DataService extends RemoteService {
public String getData();
}

DataServiceAsync.java
---------------------------------
package client;
import com.google.gwt.user.client.rpc.AsyncCallback;

public interface DataServiceAsync extends AsyncCallback{
void getData(AsyncCallback callback);
}


DataServiceImpl .java
------------------------------
package server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import client.DataService;

public class DataServiceImpl extends RemoteServiceServlet implements
DataService{
public String getData(){
return ("From Server: Your command is my wish");
}
}

HelloServlet.java
-----------------------
package com.prithvi.gwt.sample.hello.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

/**
* HelloServlet application.
*/
public class HelloServlet implements EntryPoint {
private static DataServiceAsync service = null;
private Label label = new Label("Welcome, talk to server");
public void onModuleLoad() {
// execute the service
getService().getData(new AsyncCallback() {

public void onFailure(Throwable e) {
label.setText("Server call failed");
}

public void onSuccess(Object obj) {
if (obj != null) {
label.setText(obj.toString());
} else {
label.setText("Server call returned nothing");
}
}
});
RootPanel content = RootPanel.get("content");
content.add(label);
}

public static DataServiceAsync getService() {
if (service == null) {
/**** The following line of code cause ERROR **/
service = (DataServiceAsync) GWT.create(DataService.class);
((ServiceDefTarget) service).setServiceEntryPoint
(GWT.getModuleBaseURL()+ "/DataService");
}
return service;
}
}

HelloServlet.gwt.xml
-----------------------------
<module>
<inherits name="com.google.gwt.user.User"/>

<entry-point class="com.prithvi.gwt.sample.hello.client.HelloServlet"/
>
<servlet path="/DataService"
class="com.prithvi.gwt.sample.hello.server.DataServiceImpl"/>

</module>

HelloServlet.html
------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<title>Hello Servlet</title>
<script type="text/javascript" language="javascript"
src="com.prithvi.gwt.sample.hello.HelloServlet.nocache.js"></script>
</head>
<body bgcolor="white">
<h1>Hello Servlet</h1>
<table align="center" width="100%">
<tr>
<td id="content"></td>
</tr>
</table>
</body>
</html>

HelloServlet-compile.cmd
-------------------------------------
@java -Xmx256M -cp "%~dp0\src;%~dp0\bin;%E:/GoogleWidgetToolkit/gwt-
windows-1.5.3/gwt-user.jar;E:/GoogleWidgetToolkit/gwt-windows-1.5.3/
gwt-dev-windows.jar" com.google.gwt.dev.GWTCompiler -out "%~dp0\www"
%* HelloServlet

HelloServlet-shell.cmd
--------------------------------
@java -Xmx256M -cp "%~dp0\src;%~dp0\bin;%E:/GoogleWidgetToolkit/gwt-
windows-1.5.3/gwt-user.jar;E:/GoogleWidgetToolkit/gwt-windows-1.5.3/
gwt-dev-windows.jar" com.google.gwt.dev.GWTShell -out "%~dp0\www" %*
HelloServlet/HelloServlet.html

------------- the source code is done as accordingly following the
example available @ http://lkamal.blogspot.com/2008/09/java-gwt-servlets-web-app-tutorial.html#gwt-servlet-1
------------

But when compiling the project I have encountered with the following
error.......

Compiling module HelloServlet
Scanning for additional dependencies: file:/E:/GWT_WORKSPACE/
HelloServlet/src/client/HelloServlet.java
Computing all possible rebind results for 'client.DataService'
Rebinding client.DataService
Invoking <generate-with
class='com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator'/
>
Generating client proxy for remote service interface
'client.DataService'
Checking the synchronous interface 'client.DataService'
against its asynchronous version 'client.DataServiceAsync'
[ERROR] The asynchronous version of
client.DataService has more methods than the synchronous version
A valid definition for the asynchronous version of
interface 'client.DataService' would be:

[ERROR]
package client;

public interface DataServiceAsync {
void reverseString(client.TestString stringToReverse,
com.google.gwt.user.client.rpc.AsyncCallback<java.lang.String> arg2);
}
[ERROR] Errors in 'file:/E:/GWT_WORKSPACE/HelloServlet/src/client/
HelloServlet.java'
[ERROR] Line 26: Failed to resolve 'client.DataService' via
deferred binding
[ERROR] Cannot proceed due to previous errors
[ERROR] Build failed
-----------------------------------------------------------------------------------------------------------------------------

Please provide your support to let me out of this problem.
Thanks in advance
Reply all
Reply to author
Forward
0 new messages