404 error when running a GWT program in Eclipse. Seems to be to do with servlet mapping

☆樱花仙子☆ 提交于 2019-12-25 04:08:51

问题


I have a GWT project which has been working fine for many weeks. On opening the code yesterday I found dozens of big red errors in my code. I've seen this happen before and have learnt, after much frustration, that all I need to is clean the project for Eclipse to be happy again, so I did that. Fine.

However, when I run the thing, I get a 404 error saying this: type Status report message /LittleRedGarden/littleredgarden/greet description The requested resource (/LittleRedGarden/littleredgarden/greet) is not available.

The message gets written in HTML in the console in Eclipse.

I'll insert my web.xml file in full at the bottom, but it seems to point to the paths mentioned above ok. I should say that the web.xml file was built by Eclipse without any supervision from me, and as I say, has been working fine until now.

Where do I start looking for a solution to this?

Thanks. web.xml contents here:

<?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>

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>com.ducksstory.littleredgarden.server.GreetingServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/littleredgarden/greet</url-pattern>
  </servlet-mapping>

  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>LittleRedGarden.html</welcome-file>
  </welcome-file-list>

</web-app>

Here's GreetingService.java:

package com.ducksstory.littleredgarden.client;

import com.ducksstory.littleredgarden.shared.QuestionStrings;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * The client side stub for the RPC service.
 */
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService
{
    String greetServer(String name) throws IllegalArgumentException;
    QuestionStrings getQuestion(int i);
    String[] getMainImages();
}

回答1:


I've fixed this just by restarting Eclipse. What a waste of time! Thanks for trying to help.




回答2:


Upto my knowledge there is no pbm with your web.xml file. But you may check with your service file written in the client package. In your case your service file name should be GreetingService.java . Check in that file whether you are used the proper annotation

@RemoteServiceRelativePath("greet")

If this one also fine with your file then you can download a sample gwt project and do the comparison. Correct me if i'm wrong..



来源:https://stackoverflow.com/questions/8716579/404-error-when-running-a-gwt-program-in-eclipse-seems-to-be-to-do-with-servlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!