关于 java:GWT Maven 应用程序入口点未加载
GWT Maven Application Entry Point not loaded
我正在尝试构建一个新的 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/resources
--- com.myapp.admin
webapp.gwt.xml
- - Spring
myapp.beans.xml
-- src/main/webapp
myapp-admin.html
myapp-admin.css
--- js
--- 元信息
- - 资源
--- 网络信息
应用程序上下文.xml
web.xml
web.xml 文件:
|
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<?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> <!-- Add Support for Spring --> <!-- exposes the request to the current thread --> <!-- UTF-8 filter --> </web-app> |
webapp.gwt.xml:
|
1
2 3 4 5 6 7 8 9 10 11 12 13 |
<?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. --> <source path='myapp.admin.webapp.client'/> </module> |
我的简单入口点:
|
1
2 3 4 5 6 7 8 9 10 11 12 13 |
public class AdminEntryPoint implements EntryPoint {
@Override GWT.log("Hello World!", null); } |
还有我基本上是空的应用上下文:
|
1
2 3 4 5 6 7 8 9 |
<?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)时,似乎没有问题。我可以使用"开发模式"启动我的应用程序并加载欢迎页面,但没有入口点。
当我尝试调试我的应用程序(将断点设置为 AdminEntryPoint 中的 onLoad 函数)时,它从未走得这么远。
所以看起来我的应用程序运行完美并且根本不知道它的入口点,尽管它是在 webapp.gwt.xml 中设置的。
感谢任何帮助:)
相关讨论
- 请分享 myapp-admin.html。它是否在您的 html 文件中定义了
<script type="text/javascript" \t\tsrc="https://www.codenong.com/22254533/myapp/myapp.nocache.js"> ?在 gwt.xml 中定义 rename-to<module rename-to='myapp'> 。将源路径更改为<source path='client' />
有些东西不见了。请更新或确认您的文件,如下所示:
webapp.gwt.xml:(添加重命名并更改源路径)
|
1
2 3 4 5 6 7 8 9 10 11 12 13 |
<?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. --> <source path='client'/> </module> |
myapp-admin.html:(符合下一行)
|
1
|
<script type="text/javascript" src="https://www.codenong.com/22254533/myapp/myapp.nocache.js">
|
在运行您的应用程序之前,删除所有 GWT 缓存文件并重新开始 GWT 编译。