1

I've written a quick GWT app with the following code:

MyTaskService

package com.google.gwt.mytasks.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("taskAction")
public interface MyTasksService extends RemoteService {
    public void addTask(String title, String description);
}

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <!-- Default page to serve -->
    <welcome-file-list>
        <welcome-file>MyTasks.html</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>MyTasksService</servlet-name>
        <servlet-class>com.google.gwt.mytasks.server.MyTasksServiceImpl</servlet-class>
    </servlet>

    <servlet-mapping>
  <servlet-name>MyTasksService</servlet-name>
  <url-pattern>/mytasks/taskAction</url-pattern>
</servlet-mapping>

</web-app>

Module.gwt.xml

<module rename-to='mytasks'>
    <inherits name="com.google.gwt.user.User"/>
    <inherits name="com.google.gwt.user.theme.standard.Standard"/>
    <entry-point class="com.google.gwt.mytasks.client.MyTasks"/>

<!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>



</module>

Every time I click on the submit button I get the following error:

com.google.gwt.user.client.rpc.StatusCodeException: 404 Error 404 NOT_FOUND

HTTP ERROR: 404

NOT_FOUND

RequestURI=/com.google.gwt.mytasks.MyTasks/taskAction

Powered by Jetty://





















jwesonga
  • 4,249
  • 16
  • 56
  • 83

1 Answers1

4

The problem seems to be that GWT isn't renaming the module before publishing, i you have a look at RemoteServiceRelativePath annotation documentation it defines the servlet path as GWT.getModuleBaseURL() + value(), being value() the value given to the annotation. One easy solution that might work would be to define the servlet mapping at the path the module is looking at.

Instead of:

<servlet-mapping>
  <servlet-name>MyTasksService</servlet-name>
  <url-pattern>/mytasks/taskAction</url-pattern>
</servlet-mapping>

Use:

<servlet-mapping>
  <servlet-name>MyTasksService</servlet-name>
  <url-pattern>/com.google.gwt.mytasks.MyTasks/taskAction</url-pattern>
</servlet-mapping>
ITomas
  • 809
  • 9
  • 15
  • Thanks ITomas, the error is actually gone but now I have a new one: Caused by: org.datanucleus.exceptions.ClassNotPersistableException: The class "com.google.gwt.mytasks.server.Task" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found. – jwesonga Mar 29 '12 at 13:34