I'm having issues getting the remote services to work for one of my
new applications. I assume it has something to do with the service url
path, but couldn't find the cause.
Here's the relevant information:
I have these three classes:
- DatabaseService.java (be.nepherte.coda.client)
- DatabaseServiceAsync.java (be.nepherte.coda.client)
- DatabaseServiceImpl.java (be.nepherte.coda.server)
***DatabaseService:*****
package be.nepherte.coda.client;
import java.util.ArrayList;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;;
@RemoteServiceRelativePath("databaseService")
public interface DatabaseService extends RemoteService {
public String getTestMessage();
}
***End DatabaseService***
***DatabaseServiceAsync***
package be.nepherte.coda.client;
import java.util.ArrayList;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface DatabaseServiceAsync {
public void getTestMessage(AsyncCallback<String> callback);
}
***End DatabaseServiceAsync***
***DatabaseServiceImpl***
private DatabaseServiceImpl() {}
public String getTestMessage() {
return "This is a server message to test the GWT RPC calls";
}
***End DatabaseServiceImpl***
I call the service like this:
private DatabaseServiceAsync databaseService = (DatabaseServiceAsync)
GWT.create(DatabaseService.class);
....
AsyncCallback<String> callback = new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
Window.alert("an error occured");
}
public void onSuccess(String result) {
Window.alert(result);
}
}
databaseService.getTestMessage(callback);
I always get the "an error occured" message
My web.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/
ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>CODA</display-name>
<servlet>
<servlet-name>DatabaseService</servlet-name>
<servlet-class>be.nepherte.coda.server.DatabaseServiceImpl</servlet-
class>
</servlet>
<servlet-mapping>
<servlet-name>DatabaseService</servlet-name>
<url-pattern>/coda/databaseService</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>coda.html</welcome-file>
</welcome-file-list>
</web-app>
The deployed file structure on the server is something like:
WEB-INF/
WEB-INF/web.xml
WEB-INF/classes/be/nepherte/coda/{client,server}
WEB-INF/lib/ -- has gwt-server.jar
coda/ -- generated html files with the javascripts
coda.html
style.css
When I look in the acces logs, the attempt to access the service is:
127.0.0.1 - - [22/May/2009:21:17:47 +0200] "POST /CODA/coda/
databaseService HTTP/1.1" 500 3136
Can anybody help me out?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---