Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT: Servlet URL mapping gives a 404 error

I have read the other GWT Servlet questions, but I'm having trouble solving my problem still. My package is called Maps, and it has a service named MyService (which was set up according to a GWT Tutorial). The web.xml file includes the following:

<servlet>
    <servlet-name>MyServiceImpl</servlet-name>
    <servlet-class>com.xerox.maps.maps.server.MyServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>MyServiceImpl</servlet-name>
    <url-pattern>/Maps/service</url-pattern>
</servlet-mapping>

In MyService, I have the line:

@RemoteServiceRelativePath("service")
public interface MyService extends RemoteService { ...

However, when I try to make an RPC call, there is an error thrown. The details of the error say that it is a 404 HTTP error. How can I fix this, to make sure that the mapping is correct?

Edit 7.27

MyService.java contains the annotation:

@RemoteServiceRelativePath("service")

And web.xml contains:

<servlet-name>MyServiceImpl</servlet-name>
<url-pattern>/com.x.maps.Maps/service</url-pattern>

If I follow the XHR with FireBug, it shows me that there is a call to com.x.maps.Maps

like image 974
simchona Avatar asked Jul 11 '11 23:07

simchona


1 Answers

404 Not found is thrown usually when service endpoint path is inferred wrongly by GWT. Try removing @RemoteServiceRelativePath("service") and recompile and check, If that does not work find out the URL endpoint of the service manually (by hitting likely paths from a browser till the error changes to 500 internal error) and then give the correct path as argument to @RemoteServiceRelativePath("correct/path"). Few trials I would try right away is @RemoteServiceRelativePath("/Maps/service") and @RemoteServiceRelativePath("Maps/service") without the slash

like image 107
Zasz Avatar answered Sep 22 '22 15:09

Zasz