1

我正在建立一个项目,其中我使用 GWT(前端)-Spring(后端)和 Maven 使用 mojo.codehaus 插件进行依赖。当我在 eclipse 中执行 gwt:test 目标时,会出现下一个错误。

Caused by: com.google.gwt.junit.JUnitFatalLaunchException: Failed to load module "com.javierdepedrolopez.webapps.adtransport.AdTransportModule.JUnit".
[INFO] Please see the log for details.
[INFO]  at com.google.gwt.junit.server.JUnitHostImpl.service(JUnitHostImpl.java:134)
[INFO]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[INFO]  at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
[INFO]  at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
[INFO]  at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
[INFO]  at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
[INFO]  at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
[INFO]  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
[INFO]  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
[INFO]  at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
[INFO]  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
[INFO]  at org.mortbay.jetty.Server.handle(Server.java:324)
[INFO]  at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
[INFO]  at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
[INFO]  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
[INFO]  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
[INFO]  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
[INFO]  at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
[INFO]  at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

JUnit 模块:

<module rename-to="adtransportmoduleJUnit">
  <inherits name="com.javierdepedrolopez.webapps.adtransport.adtransportmodule"/>
</module>

广告传输模块:

<module rename-to='adtransportmodule'>
  <inherits name='com.google.gwt.user.User' />
  <inherits name='com.google.gwt.user.theme.standard.Standard' />
  <entry-point class='com.javierdepedrolopez.webapps.adtransport.client.AdTransportModule' />
  <source path='client' />
  <source path='shared' />
</module>

GWTTestCaseAdTransportModule.java:

public class GwtTestAdTransportModule extends GWTTestCase {

  /**
   * Must refer to a valid module that sources this class.
   */
  public String getModuleName() {
    return "com.javierdepedrolopez.webapps.adtransport.AdTransportModule";
  }

  /**
   * Tests the FieldVerifier.
   */
  public void testFieldVerifier() {
    assertFalse(FieldVerifier.isValidName(null));
    assertFalse(FieldVerifier.isValidName(""));
    assertFalse(FieldVerifier.isValidName("a"));
    assertFalse(FieldVerifier.isValidName("ab"));
    assertFalse(FieldVerifier.isValidName("abc"));
    assertTrue(FieldVerifier.isValidName("abcd"));
  }
}

Web.xml:

<web-app
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    metadata-complete="false"
    version="2.5">

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Servlets -->

    <!-- Front Controller for all GWT-Spring based servlets -->
    <servlet>
        <servlet-name>gwt</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>gwt</servlet-name>
        <url-pattern>/adtransportmodule/rpc/*</url-pattern>
        <url-pattern>/adtransportmodule/json/*</url-pattern>
    </servlet-mapping>
</web-app>

the getModule()方法中,如果我返回"com.javierdepedrolopez.webapps.adtransport.adtransportmodule"结果是eclipse控制台给出的url返回404。我已经尝试了一切但没有结果。

4

0 回答 0