GWT Maven应用程序入口点未加载

时间:2014-03-07 15:46:05

标签: java google-app-engine gwt mvp gwt-mvp

我正在尝试建立一个新的gwt项目(也使用maven和spring)。我的项目结构是:

- ...目录

  • myapp.admin-webapp
    - src / main / java
    --- com.myapp.admin.webapp.client
    AdminEntryPoint.java
    --- com.myapp.admin.webapp.client.presenter
    --- com.myapp.admin.webapp.client.view
    - src / main / recources
    --- com.myapp.admin
    webapp.gwt.xml
    ---春天 myapp.beans.xml

    - src / main / webapp
    myapp-admin.html
    myapp-admin.css
    --- js
    --- META-INF
    ---资源
    --- WEB-INF
    applicationContext.xml
    web.xml

web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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">

    <welcome-file-list>
        <welcome-file>myapp-admin.html</welcome-file>
    </welcome-file-list>

    <!-- Add Support for Spring -->
    <!-- Default applicationContext location: /WEB-INF/applicationContext.xml -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- exposes the request to the current thread -->
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <!-- UTF-8 filter -->
    <filter>
        <filter-name>characterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>characterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>

webapp.gwt.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module SYSTEM "gwt-module.dtd">

<module>

    <inherits name='com.google.gwt.user.User'/>

    <!-- Specify the app entry point class. -->   
    <entry-point class='myapp.admin.webapp.client.AdminEntryPoint'/>    

    <source path='myapp.admin.webapp.client'/>

</module>

我的简单切入点:

public class AdminEntryPoint implements EntryPoint {


    @Override
    public void onModuleLoad() {

        GWT.log("Hello World!", null);
        Label label = new Label("Entry Point!");
        label.setStyleName("label");
        RootPanel.get().add(label);
    }

}

我基本上是空的应用程序上下文:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <context:annotation-config />

</beans>

当我尝试启动我的应用程序(IDE Eclipse)时,似乎没有问题。我可以使用&#34;开发模式启动我的应用程序&#34;并且加载了欢迎页面,但没有入口点。

当我尝试调试我的应用程序(将我的断点设置为AdminEntryPoint中的onLoad函数)时,它从未走得那么远。

所以看起来我的应用程序运行完美,并且根本不知道它的入口点,尽管它在webapp.gwt.xml中设置。

任何帮助的谢谢:)

1 个答案:

答案 0 :(得分:1)

有些事情遗失了。请更新或确认您的文件,如下所示:

webapp.gwt.xml:(添加重命名并更改源路径)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module SYSTEM "gwt-module.dtd">

<module rename-to='myapp'>

    <inherits name='com.google.gwt.user.User'/>

    <!-- Specify the app entry point class. -->   
    <entry-point class='myapp.admin.webapp.client.AdminEntryPoint'/>    

    <source path='client'/>

</module>

myapp-admin.html:(符合以下行)

<script type="text/javascript" src="myapp/myapp.nocache.js"></script>

删除所有GWT缓存文件并在运行应用程序之前开始新的GWT编译。